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.

Value: static | relative | absolute | fixed | inherit<br />

Initial: static<br />

Applies to: all elements, but not to generated content<br />

Inherited: no<br />

Percentages: N/A<br />

Media: visual<br />

The values of this property have the following meanings:<br />

static<br />

The box is a normal box, laid out according to the normal flow [p. 105] . The<br />

’left’ and ’top’ properties do not apply.<br />

relative<br />

The box’s position is calculated according to the normal flow [p. 105] (this is<br />

called the position in normal flow). Then the box is offset relative [p. 107] to<br />

its normal position. When a box B is relatively positioned, the position of the<br />

following box is calculated as though B were not offset.<br />

absolute<br />

The box’s position (and possibly size) is specified with the ’left’, ’right’, ’top’,<br />

and ’bottom’ properties. These properties specify offsets with respect to the<br />

box’s containing block [p. 96] . Absolutely positioned boxes are taken out of<br />

the normal flow. This means they have no impact on the layout of later<br />

siblings. Also, though absolutely positioned [p. 113] boxes have margins,<br />

they do not collapse [p. 86] with any other margins.<br />

fixed<br />

The box’s position is calculated according to the ’absolute’ model, but in<br />

addition, the box is fixed [p. 113] with respect to some reference. In the case<br />

of continuous <strong>media</strong> [p. 79] , the box is fixed with respect to the viewport<br />

[p. 96] (and doesn’t move when scrolled). In the case of paged <strong>media</strong> [p. 79]<br />

, the box is fixed with respect to the page, even if that page is seen through<br />

a viewport [p. 96] (in the case of a print-preview, for example). Authors may<br />

wish to specify ’fixed’ in a <strong>media</strong>-dependent way. For instance, an author<br />

may want a box to remain at the top of the viewport [p. 96] on the screen,<br />

but not at the top of each printed page. The two specifications may be separated<br />

by using an @<strong>media</strong> rule [p. 78] , as in:<br />

Example(s):<br />

@<strong>media</strong> screen {<br />

H1#first { position: fixed }<br />

}<br />

@<strong>media</strong> print {<br />

H1#first { position: static }<br />

}<br />

9.3.2 Box offsets: ’top’, ’right’, ’bottom’, ’left’<br />

An element is said to be positioned if its ’position’ property has a value other than<br />

’static’. Positioned elements generate positioned boxes, laid out according to four<br />

properties:<br />

103

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

Saved successfully!

Ooh no, something went wrong!