CSS Dimension


The CSS dimension properties allow you to control the height and width of an element.


Examples

Try it Yourself - Examples

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

Set the height of an image using percent
This example demonstrates how to set the height of an element using a percent value.

Set the width of an element using a pixel value
This example demonstrates how to set the width of an element using a pixel value.

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

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

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

Set the minimum width of an element using a pixel value
This example demonstrates how to set the minimum width of an element using a pixel value.


All CSS Dimension Properties

Property Description Values
height Sets the height of an element auto
length
%
inherit
max-height Sets the maximum height of an element none
length
%
inherit
max-width Sets the maximum width of an element none
length
%
inherit
min-height Sets the minimum height of an element length
%
inherit
min-width Sets the minimum width of an element length
%
inherit
width Sets the width of an element auto
length
%
inherit


Color Picker

colorpicker