Latest web development tutorials

CSS dimension (Dimension)

CSS size (Dimension) attribute allows you to control the height and width of the element. Likewise, it allows you to add line spacing.


Examples

More examples

Sets the height of the element

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

Using the set as a percentage of the image height

This example demonstrates how to use a percentage of the value of the element height.

Using the pixel value to set the element's width

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

The maximum height of the element

This example shows how to set the maximum height of the element.

Use a percentage to set the element's maximum width

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 shows how to set the minimum height of the element.

The minimum width of the element using a pixel value

This example demonstrates how to use the minimum width of the pixel value of the element.


All CSS size (Dimension) property

Attributes description
height Sets the height of the element.
line-height Setting high line.
max-height Sets the maximum height of the element.
max-width Sets the maximum width of an element.
min-height Set the minimum height of the element.
min-width Sets the minimum width of an element.
width Set the width of the element.