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.

Contents<br />

7 Media types<br />

7.1 Introduction to <strong>media</strong> types . . . . . . . . . . 77 .<br />

7.2 Specifying <strong>media</strong>-dependent style sheets . . . . . . . 77 .<br />

7.2.1 The @<strong>media</strong> rule . . . . . . . . . . . 78 .<br />

7.3 Recognized <strong>media</strong> types . . . . . . . . . . . 78 .<br />

7.3.1 Media groups . . . . . . . . . . . . 79 .<br />

7.1 Introduction to <strong>media</strong> types<br />

One of the most important features of style sheets is that they specify how a<br />

document is to be presented on different <strong>media</strong>: on the screen, on paper, with a<br />

speech synthesizer, with a braille device, etc.<br />

Certain CSS properties are only designed for certain <strong>media</strong> (e.g., the<br />

’cue-before’ property for aural user agents). On occasion, however, style sheets<br />

for different <strong>media</strong> types may share a property, but require different values for<br />

that property. For example, the ’font-size’ property is useful both for screen and<br />

print <strong>media</strong>. However, the two <strong>media</strong> are different enough to require different<br />

values for the common property; a document will typically need a larger font on a<br />

computer screen than on paper. Experience also shows that sans-serif fonts are<br />

easier to read on screen, while fonts with serifs are easier to read on paper. For<br />

these reasons, it is necessary to express that a style sheet -- or a section of a<br />

style sheet -- applies to certain <strong>media</strong> types.<br />

7.2 Specifying <strong>media</strong>-dependent style sheets<br />

There are currently two ways to specify <strong>media</strong> dependencies for style sheets:<br />

Specify the target medium from a style sheet with the @<strong>media</strong> or @import<br />

at-rules.<br />

Example(s):<br />

@import url("loudvoice.css") aural;<br />

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

/* style sheet for print goes here */<br />

}<br />

Specify the target medium within the document language. For example, in<br />

HTML 4.0 ([HTML40]), the "<strong>media</strong>" attribute on the LINK element specifies<br />

the target <strong>media</strong> of an external style sheet:<br />

77

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

Saved successfully!

Ooh no, something went wrong!