-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
447 lines (352 loc) · 18 KB
/
Overview.html
File metadata and controls
447 lines (352 loc) · 18 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang=en>
<head><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Image Values Module Level 3</title>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Image Values Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 June 2009</h2>
<dl>
<dt>This version:</dt>
<!-- <dd><a href="http://www.w3.org/TR/2009/CR-css3-images-20090624/">http://www.w3.org/TR/2009/CR-css3-images-20090624/</a></dd> -->
<dd><a
href="http://dev.w3.org/csswg/css3-images/">http://dev.w3.org/csswg/css3-images/</a>
<!-- <dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/css3-images/">http://www.w3.org/TR/css3-images/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2008/CR-css3-namespace-20080523/">http://www.w3.org/TR/2008/CR-css3-namespace-20080523/</a></dd> -->
<dt>Editor:
<dd><a href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2009 <a
href="http://www.w3.org/"><acronym title="World Wide Web
Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a
href="http://www.ercim.org/"><acronym title="European Research Consortium
for Informatics and Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>This CSS Image Values module defines the syntax for <image> values
in CSS. <image> values can be a single URI to an image, a list of
URIs denoting a series of fallbacks, sprites (image slices), or gradients.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a href="mailto:www-style@w3.org">www-style@w3.org</a> (see
<a href="http://www.w3.org/Mail/Request">instructions</a>) is preferred
for discussion of this specification. When sending e-mail, please put the
text “css3-images” in the subject, preferably like this:
“[<!---->css3-images<!---->] <em>…summary of
comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1 </span>Introduction</a>
<li><a href="#conformance"><span class=secno>2 </span>Conformance</a>
<li><a href="#image"><span class=secno>3 </span>The <image> value
type</a>
<li><a href="##url"><span class=secno>4 </span>Image References and Image
Slices: the ‘<code class=css>url()</code>’ notation</a>
<li><a href="##image"><span class=secno>5 </span>Image Fallbacks: the
‘<code class=css>image()</code>’ notation</a>
<li><a href="#image-sprites"><span class=secno>6 </span>Image Sprites</a>
<li><a href="#resolution-units"><span class=secno>7 </span>Resolution
Units</a>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#informative-references">Informative
references</a>
</ul>
</ul>
<!--end-toc-->
<div>
<h2 id=intro><span class=secno>1 </span>Introduction</h2>
<p><em>This section is non-normative.</em></p>
<p>In CSS Levels 1 and 2, image values, such as those used in the
‘<code class=property>background-image</code>’ property,
could only be given by a single URI value. This module introduces
additional notations that allow a 2D image to be given as a list of URIs
denoting fallbacks, as a slice of a larger image (sprite), and as a
gradient.</p>
</div>
<div>
<h2 id=conformance><span class=secno>2 </span>Conformance</h2>
<p>A document or implementation cannot conform to CSS Image Values Level 3
alone, but can claim conformance to CSS Image Values Level 3 if it
satisfies the conformance requirements in this specification when
implementing CSS or another host language that normatively references
this specification.</p>
<p>Conformance to CSS Namespaces is defined for two classes:
<dl>
<dt><dfn id=style-sheet>style sheet</dfn>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
style sheet</a> (or a complete unit of another host language that
normatively references CSS Namespaces).
<dt><dfn id=interpreter>interpreter</dfn>
<dd>Someone or something that interprets the semantics of a style sheet.
(CSS <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user
agents</a> fall under this category.)
</dl>
<p>The conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words "MUST",
"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
document are to be interpreted as described in RFC 2119. However, for
readability, these words do not appear in all uppercase letters in this
specification. All of the text of this specification is normative except
sections explicitly marked as non-normative, examples, and notes. <a
href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a></p>
<p>Examples in this specification are introduced with the words "for
example" or are set apart from the normative text with
<code>class="example"</code>, like this:
<div class=example>
<p>This is an example of an informative example.</p>
</div>
<p>Informative notes begin with the word "Note" and are set apart from the
normative text with <code>class="note"</code>, like this:
<p class=note>Note, this is an informative note.</p>
</div>
<div>
<h2 id=image><span class=secno>3 </span>The <image> value type</h2>
<p>The <image> value type denotes a 2D image. It is defined as
<pre
class=prod><dfn id=ltimagegt><image></dfn> = <url> | <sprite> | <image-list></pre>
<p>Image values can be used in many CSS properties, including the
‘<code class=property>background-image</code>’, ‘<code
class=property>list-style-image</code>’, ‘<code
class=property>cursor</code>’ properties <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
<div>
<h2 id="#url"><span class=secno>4 </span>Image References and Image
Slices: the ‘<code class=css>url()</code>’ notation</h2>
<p>The simplest way to indicate an image is to reference an image file by
URI. This is done with the <a
href="http://www.w3.org/TR/CSS21/syndata.html#uri">‘<code
class=css>url()</code>’ notation</a>, defined in <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
<div class=example>
<p>In the example below, a background image is specified with
‘<code class=css>url()</code>’ syntax:</p>
<pre>background-image: url(wavy.png);</pre>
</div>
<p>A portion of an image may be referenced (clipped out and used as a
standalone image) by use of fragment identifiers. <span class=issue>Need
a spec to reference here. Expecting to get one from <a
href="http://www.w3.org/2008/WebVideo/Fragments/">Media Fragments
WG</a>.</span>
<div class=example>
<p>For example,</p>
<pre>background-image: url('logos.png#xywh=10,30,60,20')</pre>
<p>uses the 60 pixel by 20 pixel rectangle of <code>logos.png</code>
beginning at the point 10 pixels in from the left, 30 pixels down from
the top.
<p class=note>Note that quotation marks are required here, because
unquoted commas are not allowed in ‘<code
class=css>url()</code>’ syntax.</p>
</div>
</div>
<div>
<h2 id="#image"><span class=secno>5 </span>Image Fallbacks: the
‘<code class=css>image()</code>’ notation</h2>
<p>The ‘<code class=css>image()</code>’ notation allows an
author to specify multiple images, each one a fallback for the previous.
The UA must use only the first image that it can load and display. The
syntax for ‘<code class=css>image()</code>’ is defined as
<pre class=prod><dfn id=ltimage-listgt><image-list></dfn> = <!--
-->image( [ <image-decl> , ]* [ <image-decl> ] [ or <color> ]? )</pre>
<p>where <image-decl> is given by
<pre class=prod><dfn id=ltimage-declgt><image-decl></dfn> = <!--
-->[ <string> | <url-token> ] [ snap? && <resolution> ]?
</pre>
<p><url-token> is given as
<code>[!#$%&*-~]|{nonascii}|{escape}</code> (i.e. the contents of
‘<code class=css>url()</code>’) using the productions in the
<a href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">CSS2.1
tokenization</a>. <strong>The <url-token> must not contain
unescaped brackets, commas, white space characters, single quotes
(') or double quotes ("); if it does the ‘<code
class=css>image()</code>’ containing it is invalid.</strong>
<p>Each string or url-token represents the URI of an image. If a
resolution is given, then the image must be rendered at the specified
resolution. If the ‘<code class=css>snap</code>’ keyword is
also specified, and the image is a raster image, then the image must be
rendered at the resolution closest to the specified resolution that
would result in no pixel rounding. <span class=issue>I don't think "no
pixel rounding" is the right terminology here... basically we want to
avoid blurry images.</span></p>
<p>The optional color at the end of the list is the <dfn
id=fallback-color>fallback color</dfn>. It is used if, and only if, none
of the images can be loaded and displayed (e.g. because they are in
unsupported formats, or cannot be found, or are corrupted in some way,
or because image loading is disabled in the UA). It is treated as a
single-color image with no intrinsic dimensions.
<div class=example>
<p>For example, the rule below would tell the UA to load ‘<code
class=css>wavy.svg</code>’ if it can; failing that to load
‘<code class=css>wavy.png</code>’ and display it at 150dpi;
failing that to display ‘<code class=css>wavy.gif</code>’;
and finally, if none of the images can be loaded and displayed, to use
the color ‘<code class=css>blue</code>’ to create a
dimensionless background image.
<pre>background-image: image(wavy.svg, 'wavy.png' 150dpi, "wavy.gif" or blue);</pre>
<p>The ‘<code class=property>background-image</code>’
property specifies that dimensionless images must stretch to cover the
entire background positioning area [[CSS3BACKGROUND]], so if none of
the specified images can be displayed the background will be painted
blue. As with any image, this fallback will be painted over the
‘<code class=property>background-color</code>’ (if any).
</div>
<p>If the URL for the image ends in a file extension (a period followed
by letters) of four ascii letters ([a-zA-Z]) or less, then the UA
<em>may</em> skip trying to load images whose file extension matches an
image format it knows it does not support. For example, a UA that knows
it supports JPEG and GIF, but expects to encounter many PNG and SVG
images may choose to skip over images with filenames ending in
‘<code class=css>.png</code>’ or ‘<code
class=css>.svg</code>’ without loading them to check their MIME
type. However it must not skip over images with filenames ending in
extensions it doesn't recognize.
</div>
<div>
<h2 id=image-sprites><span class=secno>6 </span>Image Sprites</h2>
<p>The image sprites syntax is different from image slices noted above.
Image slice syntax allows you to specify the coordinates of a region in
the image and use that as a standalone image, but all the coordinates
must be specified inline. This is great for one-off cutouts, but becomes
unnecessarily verbose when the slices fit into a grid structure. The
goal of this section is to define a syntax that:
<ul>
<li>Makes it easy to specify an image slice and swap it out in later
subclass or :hover rules.
<li>Makes it easy to maintain a sprite image, so that adding or shifting
sections of the image don't require crawling through and modifying the
entire style sheet.
<li>Has straightforward handling of strict grids, but can also handle
more irregular sprite organization.
<li>(Any other use cases/requirements?)
</ul>
<div class=issue>
<p>As yet unwritten. Discussions/proposals include:</p>
<ul>
<li><a
href="http://lists.w3.org/Archives/Public/www-style/2009May/0157.html">Jorrit's
@sprite proposal</a>
<li><a
href="http://www.css3.info/summary-of-the-two-current-css-constants-proposals/#comment-212898">Adrian's
image-vars proposal</a>
<li><a
href="http://lists.w3.org/Archives/Public/www-style/2009Jan/0185.html">Discussion
from Jan 2008</a> and <a
href="http://lists.w3.org/Archives/Public/www-style/2009Jan/0284.html">Jorrit's
response</a>
</ul>
</div>
<div>
<h2 id=resolution-units><span class=secno>7 </span>Resolution Units</h2>
<p>This specification defines the following units as part of the <dfn
id=ltresolutiongt><resolution></dfn> value type:
<dl>
<dt>dpi
<dd>dots per inch
<dt>dpcm
<dd>dots per centimeter
<dt>dppx
<dd>dots per ‘<code class=css>px</code>’ unit
</dl>
<p class=note>The default resolution of raster images in CSS is
‘<code class=css>1dppx</code>’.</p>
</div>
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
<h2 class=no-num id=references>References</h2>
<h3 class=no-num id=normative-references>Normative references</h3>
<!--begin-normative--> <!-- Sorted by label -->
<dl class=bibliography>
<dt style="display:
none"><!-- keeps the doc valid if the DL is empty --> <!---->
<dt id=CSS21>[CSS21]
<dd>Bert Bos; et al. <a
href="http://www.w3.org/TR/2009/CR-CSS21-20090423"><cite>Cascading
Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a> 23
April 2009. W3C Candidate Recommendation. (Work in progress.) URL: <a
href="http://www.w3.org/TR/2009/CR-CSS21-20090423">http://www.w3.org/TR/2009/CR-CSS21-20090423</a>
</dd>
<!---->
<dt id=RFC2119>[RFC2119]
<dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
words for use in RFCs to Indicate Requirement Levels.</cite></a>
Internet RFC 2119. URL: <a
href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
</dd>
<!---->
</dl>
<!--end-normative-->
<h3 class=no-num id=informative-references>Informative references</h3>
<!--begin-informative--> <!-- Sorted by label -->
<dl class=bibliography>
<dt style="display:
none"><!-- keeps the doc valid if the DL is empty --> <!---->
</dl>
<!--end-informative--></div>
</div>
</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
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:t
sgml-general-insert-case:lower
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->