Name

width

Synopsis

This defines the width of an element’s content area, outside of which padding, borders, and margins are added. This property is ignored for inline nonreplaced elements. Negative length and percentage values are not permitted.

Values:

<length> | <percentage> | auto | inherit

Initial value:

auto

Applies to:

block-level and replaced elements

Inherited:

no

Percentages:

refer to the width of the containing block

Computed value:

for auto and percentage values, as specified; otherwise, an absolute length, unless the property does not apply to the element (then auto)

Get Cascading Style Sheets: The Definitive Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.