width attribute

Type:length
Inherited:no
Used By:All block elements
Default:none
See:background-image-width border height margin padding size

The width of the object on the page, or for pages it's the width of the page itself. The width is the total of any horizontal margin, border and padding, as well as the content of the element itself.

For arcto elements, the width is the width of the ellipse the arc is taken from.

The width element may be specified as a percentage, in which case it's relative to the width of the containing block. If the containing block has no width specified, the value is unset. If the containing block is the body tag, the width is the width of the page (in this respect it differs to the height attribute).

Here the page is 595 points wide, the DIV is the width of the page less whatever margin the page has, and the P element is half the width of the DIV, less whatever margin the DIV has.

<body width="595" height="842">
  <div height="100%">
    <p height="50%" border="1">50% of the DIV</p>
  </div>
</body>

These two lines give identical results - a document with a default page size of ISO A4

<body width="210mm" height="297mm">
<body size="A4">