width

Sets the width of an element. It can be defined in absolute units like pixels or relative units like percentages.

Quick example

.container {
  width: 100%;
  max-width: 1200px;
  /* responsive width was a max limit */
}

Quick facts

Initial value
auto
Inherited
No
Applies to
all elements but non-replaced and table rows
Animation type
lpc

Values

autolength-percentagemin-contentmax-contentfit-contentcalc-sizeanchor-size

width Browser Support

Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

Safe to use without fallbacks.

1+
1+
1+
12+
ESC