From W3C Wiki
Jump to: navigation, search


The width property specifies the content width of boxes.


Values <length> | <percentage> | auto | inherit
Initial value auto
Applies to All elements but non-replaced inline elements, table rows, and row groups
Inherited No


  • <length>
    Specifies the width of the content area using a length unit.

  • <percentage>
    Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block.

  • auto
    The width depends on the values of other properties.

  • inherit
    Takes the same specified value as the property for the element's parent.


Example A


 p {
   width: 400px;
   height: 200px;
   background-color: #999;


  <p>This is a paragraph.</p>

Csslist2 width.png

CSS Reference

The CSS specification defines the width property in 10.2 Content width.