Computers & ProgrammingCSSWeb Development

CSS Height and Width

CSS includes several height and width properties to help you specify the dimensions of your HTML elements. There are six different CSS properties that can used to specify the height and width of an element. They are as follows: height, width, min-height, max-height, min-width and max-width.

In addition, you can assign the auto and inherit value as well. You can assign each property either a fixed measurement (px,pt,em,etc.) or a perentage value.

For example, if you specify a percentage value for the width property, the width of the element you are styling will be set to a percentage of the parent element’s width.

PropertyDescriptionValues
heightHeight of an elementauto, measurement, percentage, inherit
widthWidth of an elementauto, measurement, percentage, inherit
min-heightMinimum height of an elementmeasurement, percentage, inherit
min-widthMinimum width of an elementmeasurement, percentage, inherit
max-heightMaximum height of an elementmeasurement, percentage, inherit
max-widthMaximum width of an elementmeasurement, percentage, inherit

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top