Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://crydee.sai.msu.ru/~vab/html.doc/css2/media.html
Дата изменения: Tue May 12 12:27:50 1998 Дата индексирования: Tue Oct 2 01:38:18 2012 Кодировка: Поисковые слова: jet |
Contents
Certain CSS properties are only designed for certain media (e.g., the 'cue-before' property for aural user agents). On occasion, however, style sheets for different media types may share a property, but require different values for that property. For example, the 'font-size' property is useful both for screen and print media. However, the two media are different enough to require different values for the common property; a document will typically need a larger font on a computer screen than on paper. Experience also shows that sans-serif fonts are easier to read on screen, while fonts with serifs are easier to read on paper. For these reasons, it is necessary to express that a style sheet -- or a section of a style sheet -- applies to certain media types.
There are currently two ways to specify media dependencies for style sheets:
@import url("loudvoice.css") aural; @media print { /* style sheet for print goes here */ }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <HTML> <HEAD> <TITLE>Link to a target medium</TITLE> <LINK rel="stylesheet" type="text/css" media="print, handheld" href="foo.css"> </HEAD> <BODY> <P>The body... </BODY> </HTML>
The @import rule is defined in the chapter on the cascade.
An @media rule specifies the target media types (separated by commas) of a set of rules (delimited by curly braces). The @media construct allows style sheet rules for various media in the same style sheet:
@media print { BODY { font-size: 10pt } } @media screen { BODY { font-size: 12pt } } @media screen, print { BODY { line-height: 1.2 } }
A CSS media type names a set of CSS properties. A user agent that claims to support a media type by name must implement all of the properties that apply to that media type.
The names chosen for CSS media types reflect target devices for which the relevant properties make sense. In the following list of CSS media types, the parenthetical descriptions are not normative. They only give a sense of what device the media type is meant to refer to.
Media type names are case-insensitive.
Due to rapidly changing technologies, CSS2 does not specify a definitive list of media types that may be values for @media.
Note. Future versions of CSS may extend this list. Authors should not rely on media type names that are not yet defined by a CSS specification.
Each CSS property definition specifies the media types for which the property must be implemented by a conforming user agent. Since properties generally apply to several media, the "Applies to media" section of each property definition lists media groups rather than individual media types. Each property applies to all media types in the media groups listed in its definition.
CSS2 defines the following media groups:
The following table shows the relationships between media groups and media types:
Media Types | Media Groups | |||
---|---|---|---|---|
continuous/paged | visual/aural/tactile | grid/bitmap | interactive/static | |
aural | continuous | aural | N/A | both |
braille | continuous | tactile | grid | both |
emboss | paged | tactile | grid | both |
handheld | both | visual | both | both |
paged | visual | bitmap | static | |
projection | paged | visual | bitmap | static |
screen | continuous | visual | bitmap | both |
tty | continuous | visual | grid | both |
tv | both | visual, aural | bitmap | both |