Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS Dimension

CSS Dimension


CSS dimension properties allow you to control the height and width of an element. They also allow you to increase line spacing.


More examples

Set the height of an element

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

Set the height of an image using a percentage

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

Setting the Width of an Element Using Pixels

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

Sets the maximum height of an element.

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

Setting the Maximum Width of an Element Using a Percentage

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

Setting the Minimum Height of an Element

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

Setting the Minimum Width of an Element Using Pixels

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


All CSS Dimension Properties

property Description
height Sets the height of an element.
line-height Set line height.
max-height Sets the maximum height of an element.
max-width Sets the maximum width of an element.
min-height Sets the minimum height of an element.
min-width Sets the minimum width of an element.
width Sets the width of an element.