CSS Width

tutorial and example
tutorial and example

You can set the width of the content area of an element. It does not include padding borders or margins. You can set width of the area inside the border, padding, and margin of the element.

Value Description
auto It is a default value.
length It defines the width in px, cm etc.
% It is used to define the width of the containing block in %.
initial You can set the property to its default value.
inherit It is used to inherit the property from its parent element.

Let us see an example of CSS Width:

Try Now

Note: You can use percent (%) or px both to create CSS width.