CSS Height and Width

CSS height and width properties specifies the height and width of an element.
Here are some values of CSS height and width:

  • auto - It is the default value (The browser will calculate the measurement of height and width).
  • length - It specifies the height and width in px, cm etc.
  • % - It specifies the height and width in percentage(%).

Example:

.measurement {
  height: 200px;

  width: 50%;
}

Run Example

The max-width Property

It specifies the maximum width of the element can be. The max-width property can override the width property.

Example:

.measurement {
  height: 200px;

  max-width: 700px;
}

Run Example