View video tutorial

CSS Dimension

CSS

The dimension property allows controlling the width and height of an element.

CSS dimension properties

➔ CSS has several dimension properties that allow controlling the width and height of an element.

➔ The following properties are mostly used to control the width and height of an element.

  • height
  • width
  • line-height
  • max-height
  • max-width
  • min-height
  • min-width

Example

.p1 {
  width: 50%;
  height: 200px;
  border: 1px solid black;
}
Try it Now »

Click on the "Try it Now" button to see how it works.


Example

.p1 {
  width: 500px;
  height: 100px;
  border: 1px solid black;
}
Try it Now »

Click on the "Try it Now" button to see how it works.