-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathmedia.html
More file actions
321 lines (264 loc) · 14.5 KB
/
media.html
File metadata and controls
321 lines (264 loc) · 14.5 KB
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
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<HEAD>
<TITLE>Media types</TITLE>
<link rel="stylesheet" href="style/default.css" type="text/css">
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED.css" type="text/css">
<link rel="prev" href="cascade.html">
<link rel="next" href="box.html">
<link rel="contents" href="cover.html#minitoc">
<link rel="CSS-properties" href="propidx.html" title="properties">
<link rel="index" href="indexlist.html" title="index">
<link rel="first" href="cover.html">
</HEAD>
<BODY>
<div class="navbar">
<p><a href="cascade.html">previous</a>
<a href="box.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
<hr class="navbar">
<H1><a name="q0">7 Media types</a></H1>
<div class="subtoc">
<p><strong>Contents</strong>
<ul class="toc">
<li class="tocline2"><a href="media.html#media-intro" class="tocxref">7.1 Introduction to media types</a>
<li class="tocline2"><a href="media.html#media-sheets" class="tocxref">7.2 Specifying media-dependent style sheets</a>
<ul class="toc">
<li class="tocline3"><a href="media.html#at-media-rule" class="tocxref">7.2.1 The @media rule</a>
</ul>
<li class="tocline2"><a href="media.html#media-types" class="tocxref">7.3 Recognized media types</a>
<ul class="toc">
<li class="tocline3"><a href="media.html#media-groups" class="tocxref">7.3.1 Media groups</a>
</ul>
</ul>
</div>
<H2>7.1 <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 <a href="page.html#propdef-page-break-before" class="noxref"><span
class="propinst-page-break-before"> <del>'cue-before'</del><ins>'page-break-before'</ins></span></a> property
<del>for aural user agents).</del><ins>only applies to paged media).</ins> On occasion, however, style sheets for
different media types may share a property, but require different
values for that property. For example, the <a href="fonts.html#propdef-font-size" class="noxref"><span
class="propinst-font-size">'font-size'</span></a> property is useful both
for screen and print media. <del>However,</del>The two media <ins>types</ins> 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.
<del>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,</del><ins>Therefore,</ins> it is necessary to express that a style <del>sheet --</del><ins>sheet,</ins> or a
section of a style <del>sheet --</del><ins>sheet,</ins> applies to certain media types.
<H2>7.2 <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 <a name="x0"><span
class="index-inst" title="@media">@media</span></a> or <a name="x1"><span
class="index-inst" title="@import">@import</span></a> at-rules.
<div class="example"><P style="display:none">Example(s):</P>
<PRE>
@import <del>url("loudvoice.css") aural;</del><ins>url("fancyfonts.css") screen;</ins>
@media print {
/* style sheet for print goes here */
}
</PRE>
</div>
<LI>Specify the target medium within the document language. For
example, in HTML <del>4.0</del><ins>4</ins> (<a href="refs.html#ref-HTML4" rel="biblioentry" class="noxref"><span class="informref"> <del>[HTML40]</del><ins>[HTML4]</ins></span></a>), 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 <del>4.0//EN"></del><ins>4.01//EN"></ins>
<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>7.2.1 <a name="at-media-rule">The @media rule</a></H3>
<P>An <a name="x2"><span class="index-def" title="media">@media</span></a> rule
specifies the target <a href="#media-types">media types</a> (separated
by commas) of a set of <a
href="syndata.html#tokenization"> <del>rules</del><ins>statements</ins></a> (delimited by curly
braces). <ins>Invalid statements must be ignored per</ins> <a
href="syndata.html#rule-sets"><ins>4.1.7 "Rule sets, declaration blocks,
and selectors"</ins></a> <ins>and</ins> <a href="syndata.html#parsing-errors"><ins>4.2
"Rules for handling parsing errors."</ins></a> The <a name="x3"><span
class="index-inst" title="@media">@media</span></a> 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: <del>12pt</del><ins>13px</ins> }
}
@media screen, print {
body { line-height: 1.2 }
}
</pre>
<p> <del>7.3 Recognized media types 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</del><ins>Style rules outside</ins> of <del>the properties that</del><ins>@media rules</ins> apply to <ins>all media types</ins>
that <ins>the style sheet applies to. At-rules inside @media are invalid in
CSS2.1.</ins>
<H2><ins>7.3</ins> <a name="media-types"><ins>Recognized</ins> media <del>type.</del><ins>types</ins></a></H2>
<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 <del>types,</del><ins>types the names of media types are normative, but</ins> the
<del>parenthetical</del>descriptions are <del>not normative. They only give a sense of what device</del><ins>informative. Likewise,</ins> the <del>media type</del><ins>"Media" field in the
description of each property</ins> is <del>meant to refer to.</del><ins>informative.</ins>
<dl>
<dt><strong>all</strong>
<dd>Suitable for all devices.
<dt><strong> <del>aural Intended for speech synthesizers. See the section on aural style sheets for details.</del>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, <del>monochrome,</del>limited bandwidth).
<dt><strong>print</strong>
<dd>Intended for <del>paged, opaque</del><ins>paged</ins> 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 <del>projectors or print to transparencies.</del><ins>projectors.</ins>
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><ins>speech</ins></strong>
<dd><ins>Intended for speech synthesizers. Note: CSS2 had a similar media type
called 'aural' for this purpose. See the appendix on</ins>
<a href="./aural.html"><ins>aural style sheets</ins></a> <ins>for details.</ins>
<dt><strong>tty</strong>
<dd>Intended for media using a fixed-pitch character <del>grid, such</del><ins>grid (such</ins> as
teletypes, terminals, or portable devices with limited display
<del>capabilities.</del><ins>capabilities).</ins> 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> <del>Due to rapidly changing technologies, CSS2 does not specify a definitive list of</del>Media types <ins>are mutually exclusive in the sense</ins> that <ins>a user agent can
only support one media type when rendering a document. However, user
agents</ins> may <ins>use different media types on different canvases. For
example, a document may (simultaneously)</ins> be <del>values</del><ins>shown in 'screen' mode on
one canvas and 'print' mode on another canvas.</ins>
<p><ins>Note that a multimodal media type is still only one media
type. The 'tv' media type,</ins> for <ins>example, is a multimodal media
type that renders both visually and aurally to a single canvas.</ins>
<p>@media <del>.</del><ins>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.</ins>
<p class=note><em><strong><ins>Note:</ins></strong> <ins>Media Queries supercedes this
error handling.</ins></em>
<div class="example"><P style="display:none"><ins>Example(s):</ins></P>
<p><ins>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).</ins>
<pre>
<ins>@media screen, 3D {
P { color: green; }
}</ins>
</pre>
</div>
<div class="note"><P>
<em><strong>Note.</strong>
Future <del>versions</del><ins>updates</ins> of CSS may extend <del>this list.</del><ins>the list of media types.</ins> Authors
should not rely on media type names that are not yet defined
by a CSS specification.
</em>
</div>
<H3>7.3.1 <a name="media-groups">Media groups</a></H3>
<P><em><ins>This section is informative, not normative.</ins></em></P>
<P>Each CSS property definition specifies <del>the</del><ins>which</ins> media types <del>for which</del>the
property <del>must be implemented by a conforming user agent .</del><ins>applies to.</ins> Since properties generally apply to several <del>media,</del><ins>media
types,</ins> the "Applies to media" section of each property definition
lists <a name="x4"><span class="index-def" title="media group">media groups</span></a>
rather than individual media types. Each property applies to all media
types in the media groups listed in its definition.
<P> <del>CSS2</del><ins>CSS 2.1</ins> 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> <del>"Both" means that the property in question applies to both media groups.</del>visual</strong></a>,</span>
<span class="index-def" title="'audio' media group"><a
name="audio-media-group"><strong> <del>aural</del><ins>audio</ins></strong></a><ins>,</ins></span>
<span class="index-def" title="'speech' media group"><a
name="speech-media-group"><strong><ins>speech</ins></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> <del>"Both" means that the property in question applies to both media groups.</del>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 <del>don't). "Both" means that the property in question applies to both media groups.</del><ins>do not).</ins>
<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> <del>visual/aural/tactile</del><ins>visual/audio/speech/tactile</ins>
<TH>grid/bitmap
<TH>interactive/static
<TR><TH> <del>aural continuous aural N/A both</del>braille<TD align="center">continuous<TD align="center">tactile<TD align="center">grid<TD align="center">both</TR>
<TR><TH> <del>emboss</del><ins>embossed</ins><TD align="center">paged<TD align="center">tactile<TD align="center">grid<TD align="center"> <del>both</del><ins>static</ins></TR>
<TR><TH>handheld<TD align="center">both<TD align="center"> <del>visual</del><ins>visual, audio, speech</ins><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"> <del>static</del><ins>interactive</ins></TR>
<TR><TH>screen<TD align="center">continuous<TD align="center"> <del>visual</del><ins>visual, audio</ins><TD align="center">bitmap<TD align="center">both</TR>
<TR><TH><ins>speech</ins><TD align="center"><ins>continuous</ins><TD align="center"><ins>speech</ins><TD align="center"><ins>N/A</ins><TD align="center"><ins>both</ins></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, <del>aural</del><ins>audio</ins><TD align="center">bitmap<TD align="center">both</TR>
</TABLE>
<hr class="navbar">
<div class="navbar">
<p><a href="cascade.html">previous</a>
<a href="box.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
</BODY>
</html>