22.12.2013 Views

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

auto<br />

The width depends on the values of other properties. See the sections<br />

below.<br />

Negative values for ’width’ are illegal.<br />

Example(s):<br />

For example, the following rule fixes the content width of paragraphs at 100<br />

pixels:<br />

P { width: 100px }<br />

10.3 Computing widths and margins<br />

The computed values of an element’s ’width’, ’margin-left’, ’margin-right’, ’left’<br />

and ’right’ properties depend on the type of box generated and on each other. In<br />

principle, the computed values are the same as the specified values, with ’auto’<br />

replaced by some suitable value, but there are exceptions. The following situations<br />

need to be distinguished:<br />

1. inline, non-replaced elements<br />

2. inline, replaced elements<br />

3. block-<strong>level</strong>, non-replaced elements in normal flow<br />

4. block-<strong>level</strong>, replaced elements in normal flow<br />

5. floating, non-replaced elements<br />

6. floating, replaced elements<br />

7. absolutely positioned, non-replaced elements<br />

8. absolutely positioned, replaced elements<br />

Points 1-6 include relative positioning.<br />

10.3.1 Inline, non-replaced elements<br />

The ’width’ property does not apply. A specified value of ’auto’ for ’left’, ’right’,<br />

’margin-left’ or ’margin-right’ becomes a computed value of ’0’.<br />

10.3.2 Inline, replaced elements<br />

A specified value of ’auto’ for ’left’, ’right’, ’margin-left’ or ’margin-right’ becomes a<br />

computed value of ’0’. A specified value of ’auto’ for ’width’ gives the element’s<br />

intrinsic [p. 30] width as the computed value.<br />

10.3.3 Block-<strong>level</strong>, non-replaced elements in normal<br />

flow<br />

If ’left’ or ’right’ are given as ’auto’, their computed value is 0. The following<br />

constraints must hold between the other properties:<br />

’margin-left’ + ’border-left-width’ + ’padding-left’ + ’width’ + ’padding-right’ +<br />

’border-right-width’ + ’margin-right’ = width of containing block [p. 131]<br />

134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!