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.

with percentage values or length values (all possible combinations are given<br />

above).<br />

Example(s):<br />

BODY { background: url("banner.jpeg") right top } /* 100% 0% */<br />

BODY { background: url("banner.jpeg") top center } /* 50% 0% */<br />

BODY { background: url("banner.jpeg") center } /* 50% 50% */<br />

BODY { background: url("banner.jpeg") bottom } /* 50% 100% */<br />

If the background image is fixed within the viewport (see the ’background-attachment’<br />

property), the image is placed relative to the viewport instead<br />

of the element’s padding area. For example,<br />

Example(s):<br />

BODY {<br />

background-image: url("logo.png");<br />

background-attachment: fixed;<br />

background-position: 100% 100%;<br />

background-repeat: no-repeat;<br />

}<br />

In the example above, the (single) image is placed in the lower-right corner of<br />

the viewport.<br />

’background’<br />

Value: [ || || <br />

|| || ]<br />

| inherit<br />

Initial: not defined for shorthand properties<br />

Applies to: all elements<br />

Inherited: no<br />

Percentages: allowed on ’background-position’<br />

Media: visual<br />

The ’background’ property is a shorthand property for setting the individual<br />

background properties (i.e., ’background-color’, ’background-image’, ’background-repeat’,<br />

’background-attachment’ and ’background-position’) at the same<br />

place in the style sheet.<br />

The ’background’ property first sets all the individual background properties to<br />

their initial values, then assigns explicit values given in the declaration.<br />

Example(s):<br />

In the first rule of the following example, only a value for ’background-color’<br />

has been given and the other individual properties are set to their initial value. In<br />

the second rule, all individual properties have been specified.<br />

BODY { background: red }<br />

P { background: url("chess.png") gray 50% repeat fixed }<br />

192

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

Saved successfully!

Ooh no, something went wrong!