CSS size (Dimension)

The CSS Dimension property allows you to control the height and width of an element. Likewise, it allows you to increase the line spacing.

More examples

Set the height of the element

This example demonstrates how to set the height of different elements.

Use a percentage to set the height of the image

This example demonstrates how to set the height of an element using a percentage value.

Use the pixel value to set the width of the element

This example demonstrates how to use pixel values ​​to set the width of an element.

Set the maximum height of the element

This example demonstrates how to set the maximum height of an element.

Use percentage to set the maximum width of the element

This example demonstrates how to use a percentage value to set the maximum width of an element.

Set the minimum height of the element

This example demonstrates how to set the minimum height of an element.

Use the pixel value to set the minimum width of the element

This example demonstrates how to use pixel values ​​to set the minimum width of an element.

All CSS Dimension attributes

Attributes description
height Set the height of the element.
line-height Set the row height.
max-height Set the maximum height of the element.
max-width Set the maximum width of the element.
min-height Set the minimum height of the element.
min-width Set the minimum width of the element.
width Set the width of the element.