Menu
The width
property designates an element’s width, which does not include borders, margin, or padding.
Note that, if set, the min-width
and max-width
properties will override the width
property.
.automatic { width: auto; } .pixels { width: 400px; } .percentage { width: 60%; }
auto
Default value. Width is automatically calculated by the browser.
length
Designates the element’s width in px, cm, em, rem, etc.
%
Designates the element’s width as a percentage of its container.
initial
Sets the property to its default value.
inherit
Inherits this property’s value from its parent item.
Have a code example of width
? Submit a codepen.io demo and we'll showcase it here ↴