-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathmedia.src
More file actions
227 lines (183 loc) · 8.22 KB
/
media.src
File metadata and controls
227 lines (183 loc) · 8.22 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<!-- $Id: media.src,v 1.21 1997-10-30 08:36:32 ian Exp $ -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Media types</TITLE>
<LINK rel="next" href="box.html">
<LINK rel="previous" href="cascade.html">
<LINK rel="STYLESHEET" href="style/default.css" type="text/css">
</HEAD>
<BODY>
<H1 align="center">Media types</H1>
<!-- What is the definitive list of media types? -->
<!-- Are values case-sensitive? -->
<H2>Introduction to media types</H2>
One of the most important features of style sheets is that they allow
authors to 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 only make sense for certain media (e.g., the
<span class="propinst-cue-before">'cue-before'</span> property for
aural style sheets). 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. 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.
<P>The following sections describe how authors may specify different
style sheets for different media (all of which participate in the <a
href="./cascade.html">cascade</a>).
<H2>Specifying media-dependent style sheets</H2>
<P>There are currently two ways to specify media dependencies for
style sheets:
<UL>
<LI>Specify the target medium from a style sheet with the <span
class="index-def" title="@media">@media</span> or <span
class="index-def" title="@import">@import</span> at-rules.
<div class="example"><P>
<PRE>
@import url(loudvoice.css) speech;
@media print {
/* style sheet for print goes here */
}
</PRE>
</div>
<LI>Specify the target medium within the document language. For example,
in <a rel="biblioentry" href="./refs.html#ref-HTML40">[HTML40]</a>,
the "media" attribute on the LINK element specifies the target medium
of an external style sheet.
<div class="example"><P>
<PRE>
<LINK rel="stylesheet" type="text/css"
media="print" href="foo.css">
</PRE>
</div>
<P>Please consult the <a rel="biblioentry"
href="./refs.html#ref-HTML40">[HTML40]</a> specification for
information about specifying alternate style sheets according
to different media types.
</UL>
<P>Since these two examples have the same <a href="#media-types">media
type</a>, they are semantically equivalent.
<H3>The @media rule</H3>
<P>An @media rule lists the <a href="#media-types">media types</a>
(separated by commas) affected by a set of rules delimited by curly
braces.
<p>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: 12pt }
}
@media screen, print {
BODY { line-height: 1.2 }
}
</pre>
<H3>The media-dependent @import rule</h3>
<p>So that user agents can avoid retrieving resources for unsupported
media types, authors may specify media-dependent <a
href="cascade.html">@import</a> rules. These <span class="index-inst"
title="@import"><span class="index-def" title="conditional
import|media-dependent import">conditional imports</span></span>
specify comma-separated media types after the URL.
<div class="example">
<p>The following rules have the same effect as if the imported style
sheet were wrapped in an @media rule for the same media, but it may
save the UA a fruitless download.
<pre>
@import url(fineprint.css) print;
@import url(blueish.css) projection, tv;
</pre>
</div>
<p>In the absence of any media types, the import is
unconditional. Specifying 'all' for the medium has the same effect.
<H2><a name="media-types">Recognized media types</a></H2>
<p>Due to rapidly changing technologies, CSS2 does not specify a
definitive list of media types that may be values for <span
class="index-inst" title="@media"> @media.</span> However, user agents
that elect to support the devices in the following list must recognize
the associated media type:
<ul>
<li><samp>SCREEN:</samp> intended primarily for scrolled computer
screens, but many properties also apply to print and projection media
as well. This is the default value. See the section on
<a href="#scrolled-media">scrollable media</a> for more information.
<li><samp>PRINT:</samp> intended for paged, opaque
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.
<li><samp>PROJECTION:</samp> intended for projectors.
Please consult the section on <a href="page.html">paged media</a> for
information about formatting issues that are specific to paged media.
<li><samp>BRAILLE:</samp> intended for braille tactile feedback devices.
<li><samp>AURAL:</samp> intended for speech synthesizers. See the
section on <a href="./aural.html">aural style sheets</a> for details.
<li><samp>TV:</samp> intended for television-type devices (low
resolution, color, limited scrollability).
<li><samp>HANDHELD:</samp> intended for handheld devices (small
screen, monochrome, limited bandwidth).
<li><samp>ALL:</samp> suitable for all devices.
</ul>
<P>Media types are case-insensitive.
<H3><a name="canvas">The canvas</a></H3>
<P>For all media, the term <span class="index-def" title="canvas">
canvas</span> means "the space where the various models generate the
tree of rendering objects" (see the <a href="process.html">CSS2
process model</a>). For a screen, the canvas is a rectangular space
generally of fixed width and "infinite" length. For paged media, the
canvas is a rectangular space generally of fixed width and height.
For aural media, the canvas is a three dimensional audio space.
<H4><a name="scrolled-media">Scrollable media</a></H4>
<P>User agents for scrolled media may implement the canvas as an
"infinitely" long (or however long the rendered document is) rectangle
that has a fixed width. Users see this canvas through a user agent's
<span class="index-def" title="viewport"><em>viewport</em></span>, a
window or other viewing area on the screen. The canvas may be larger
or smaller than the viewport. Typically, when the canvas is larger
than the viewport, the user agent will offer the user a scrolling
mechanism to bring hidden parts into view.
<P>The user agent generally determines the width of the canvas and may
change the dimensions of the canvas when the viewport is resized.
<P>When an HTML document doesn't cover the entire canvas, user agents
should display the background according to the following algorithm: if
the <span class="propinst-background">'background'</span> value of the
HTML element is different from 'transparent' then use it, else use the
<span class="propinst-background">'background'</span> value of the
BODY element. If the resulting value is 'transparent', the rendering
is undefined.
<P>This rule allows the following, for example:
<div class="example"><P>
<PRE>
<HTML style="background: url(http://style.com/marble.png)">
<BODY style="background: red">
</PRE>
<P> In the example above, the canvas will be covered with
"marble". The background of the BODY element (which may or may not
fully cover the canvas) will be red.
</div>
<P>Note that no structural element of a document corresponds to the
canvas. In HTML, until other means of addressing the canvas become
available, we recommend that authors set canvas properties on the BODY
element.
</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:
-->