-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathmedia.src
309 lines (258 loc) · 11.3 KB
/
media.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<!-- $Id: media.src,v 2.49 2011-06-07 13:02:36 bbos Exp $ -->
<HEAD>
<TITLE>Media types</TITLE>
<!--script src="http://www.w3c-test.org/css/harness/annotate.js#CSS21_DEV" type="text/javascript" defer></script-->
</HEAD>
<BODY>
<H1>Media types</H1>
<H2><a name="media-intro">Introduction to media types</a></H2>
<P>One of the most important features of style sheets is that they
specify how a document is to be presented on different media: on the
screen, on paper, with a speech synthesizer, with a braille device,
etc.
<P>Certain CSS properties are only designed for certain media (e.g.,
the <span
class="propinst-page-break-before">'page-break-before'</span> property
only applies to paged media). On occasion, however, style sheets for
different media types may share a property, but require different
values for that property. For example, the <span
class="propinst-font-size">'font-size'</span> property is useful both
for screen and print media. The two media types 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.
Therefore, it is necessary to express that a style sheet, or a
section of a style sheet, applies to certain media types.
<H2><a name="media-sheets">Specifying media-dependent style sheets</a></H2>
<P>There are currently two ways to specify media dependencies for
style sheets:</p>
<UL>
<LI>Specify the target medium from a style sheet with the <span
class="index-inst" title="@media">@media</span> or <span
class="index-inst" title="@import">@import</span> at-rules.
<div class="example">
<PRE>
@import url("fancyfonts.css") screen;
@media print {
/* style sheet for print goes here */
}
</PRE>
</div>
<LI>Specify the target medium within the document language. For
example, in HTML 4 ([[-HTML4]]), the "media" attribute on the LINK
element specifies the target media of an external style sheet:
<div class="html-example">
<PRE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//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>
</PRE>
</div>
</UL>
<p>The <a href="cascade.html#at-import">@import</a> rule is defined in
the <a href="cascade.html">chapter on the cascade</a>.
<H3><a name="at-media-rule">The @media rule</a></H3>
<P>An <span class="index-def" title="media">@media</span> rule
specifies the target <a href="#media-types">media types</a> (separated
by commas) of a set of <a
href="syndata.html#tokenization">statements</a> (delimited by curly
braces). Invalid statements must be ignored per <a
href="syndata.html#rule-sets">4.1.7 "Rule sets, declaration blocks,
and selectors"</a> and <a href="syndata.html#parsing-errors">4.2
"Rules for handling parsing errors."</a> The <span
class="index-inst" title="@media">@media</span> construct allows style
sheet rules for various media in the same style sheet:</P>
<pre class="example">
@media print {
body { font-size: 10pt }
}
@media screen {
body { font-size: 13px }
}
@media screen, print {
body { line-height: 1.2 }
}
</pre>
<p>Style rules outside of @media rules apply to all media types
that the style sheet applies to. At-rules inside @media are invalid in
CSS2.1.
<H2><a name="media-types">Recognized media types</a></H2>
<!--
<p>[say that the media names are normative but the table of
media groups below is informative, i.e., cannot be tested. The "media"
line in each property is likewise informative. We expect profiles to
eventually define what properties apply where. Also explain this in
1.3.2.]
<P>A CSS <span class="index-def" title="media type"><dfn>media
type</dfn></span> 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.
-->
<P>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 names of media types are normative, but the
descriptions are informative. Likewise, the "Media" field in the
description of each property is informative.
<dl>
<dt><strong>all</strong>
<dd>Suitable for all devices.
<!--
<dt><strong>aural</strong>
<dd>Intended for speech synthesizers which also support audio sound effects.
See the section on <a href="./aural.html">aural style sheets</a> for details.
-->
<dt><strong>braille</strong>
<dd>Intended for braille tactile feedback devices.
<dt><strong>embossed</strong>
<dd>Intended for paged braille printers.
<dt><strong>handheld</strong>
<dd>Intended for handheld devices (typically small
screen, limited bandwidth).
<dt><strong>print</strong>
<dd>Intended for paged material and for documents viewed on
screen in print preview mode. Please consult the section on <a
href="page.html">paged media</a> for information about formatting
issues that are specific to paged media.
<dt><strong>projection</strong>
<dd>Intended for projected presentations, for example projectors.
Please consult the section on <a href="page.html">paged media</a> for
information about formatting issues that are specific to paged media.
<dt><strong>screen</strong>
<dd>Intended primarily for color computer screens.
<dt><strong>speech</strong>
<dd>Intended for speech synthesizers. Note: CSS2 had a similar media type
called 'aural' for this purpose. See the appendix on
<a href="./aural.html">aural style sheets</a> for details.
<dt><strong>tty</strong>
<dd>Intended for media using a fixed-pitch character grid (such as
teletypes, terminals, or portable devices with limited display
capabilities). Authors should not use <a
href="syndata.html#length-units">pixel units</a> with the "tty" media
type.
<dt><strong>tv</strong>
<dd>Intended for television-type devices (low
resolution, color, limited-scrollability screens, sound available).
</dl>
<P>Media type names are case-insensitive.
<P>Media types are mutually exclusive in the sense that a user agent can
only support one media type when rendering a document. However, user
agents may use different media types on different canvases. For
example, a document may (simultaneously) be shown in 'screen' mode on
one canvas and 'print' mode on another canvas.
<p>Note that a multimodal media type is still only one media
type. The 'tv' media type, for example, is a multimodal media
type that renders both visually and aurally to a single canvas.
<p>@media and @import rules with unknown media types (that are
nonetheless valid identifiers) are treated as if the unknown media
types are not present. If an @media/@import rule contains a malformed
media type (not an identifier) then the statement is invalid.
<p class=note><em><strong>Note:</strong> Media Queries supercedes this
error handling.</em>
<div class="example">
<p>For example, in the following snippet, the rule on the P element applies
in 'screen' mode (even though the '3D' media type is not known).
<pre>
@media screen, 3D {
P { color: green; }
}
</pre>
</div>
<div class="note"><P>
<em><strong>Note.</strong>
Future updates of CSS may extend the list of media types. Authors
should not rely on media type names that are not yet defined
by a CSS specification.
</em>
</div>
<H3><a name="media-groups">Media groups</a></H3>
<P><em>This section is informative, not normative.</em></P>
<P>Each CSS property definition specifies which media types the
property applies to. Since properties generally apply to several media
types, the "Applies to media" section of each property definition
lists <span class="index-def" title="media group">media groups</span>
rather than individual media types. Each property applies to all media
types in the media groups listed in its definition.
<P>CSS 2.1 defines the following media groups: </P>
<ul>
<li>
<span class="index-def" title="'continuous' media group"><a
name="continuous-media-group"><strong>continuous</strong></a></span>
or <span class="index-def" title="'paged' media group"><a
name="paged-media-group"><strong>paged</strong></a></span>.
<li><span
class="index-def" title="'visual' media group"><a
name="visual-media-group"> <strong>visual</strong></a>,</span>
<span class="index-def" title="'audio' media group"><a
name="audio-media-group"><strong>audio</strong></a>,</span>
<span class="index-def" title="'speech' media group"><a
name="speech-media-group"><strong>speech</strong></a>,</span>
or <span
class="index-def" title="'tactile' media group"><a
name="tactile-media-group"><strong>tactile</strong></a></span>.
<li><span
class="index-def" title="'grid' media group"><a
name="grid-media-group"><strong>grid</strong></a></span> (for
character grid devices), or
<span
class="index-def" title="'bitmap' media group"><a
name="bitmap-media-group"><strong>bitmap</strong></a></span>.
<li><span
class="index-def" title="'interactive media group"><a
name="interactive-media-group"><strong>interactive</strong></a></span> (for
devices that allow user interaction), or
<span
class="index-def" title="'static' media group"><a
name="static-media-group"><strong>static</strong></a></span> (for
those that do not).
<li><span class="index-def" title="'all'
media group"> <a name="all-media-group"><strong>all</strong></a></span>
(includes all media types)
</ul>
<P>The following table shows the relationships
between media groups and media types:</P>
<TABLE border=1
summary="Relationship between media groups and media types">
<CAPTION>Relationship between media groups and media types</CAPTION>
<TR><TH>Media Types <TH colspan="4">Media Groups
<TR><TH>
<TH>continuous/paged
<TH>visual/audio/speech/tactile
<TH>grid/bitmap
<TH>interactive/static
<!--
<TR><TH>audio<TD align="center">continuous<TD align="center">audio<TD align="center">N/A<TD align="center">both</TR>
<TR><TH>aural<TD align="center">continuous<TD align="center">speech, audio<TD align="center">N/A<TD align="center">both</TR>
-->
<TR><TH>braille<TD align="center">continuous<TD align="center">tactile<TD align="center">grid<TD align="center">both</TR>
<TR><TH>embossed<TD align="center">paged<TD align="center">tactile<TD align="center">grid<TD align="center">static</TR>
<TR><TH>handheld<TD align="center">both<TD align="center">visual, audio, speech<TD
align="center">both<TD align="center">both</TR>
<TR><TH>print<TD align="center">paged<TD align="center">visual<TD
align="center">bitmap<TD align="center">static</TR>
<TR><TH>projection<TD align="center">paged<TD align="center">visual<TD align="center">bitmap<TD align="center">interactive</TR>
<TR><TH>screen<TD align="center">continuous<TD align="center">visual, audio<TD align="center">bitmap<TD align="center">both</TR>
<TR><TH>speech<TD align="center">continuous<TD align="center">speech<TD align="center">N/A<TD align="center">both</TR>
<TR><TH>tty<TD align="center">continuous<TD align="center">visual<TD align="center">grid<TD align="center">both</TR>
<TR><TH>tv<TD align="center">both<TD align="center">visual, audio<TD align="center">bitmap<TD align="center">both</TR>
</TABLE>
</BODY>
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
End:
-->