forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
495 lines (366 loc) · 17.8 KB
/
Copy pathOverview.html
File metadata and controls
495 lines (366 loc) · 17.8 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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head><meta content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<title>CSS3 Values and Units</title>
<style type="text/css">
.issue { color: red }
table { border-collapse: collapse; border: 1px solid black; margin: 1em 0 }
th, td { border: 1px solid black; padding: 0.2em; text-align: left }
tt.declaration { white-space: nowrap }
.del { text-decoration: line-through}
.say { font-style: italic }
</style>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" 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 id=css3-template>CSS3 Values and Units</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 3 June 2009</h2>
<dl>
<dt>This version:
<dd><a
href="http://www.w3.org/TR/2009/ED-css3-values-20090603">http://www.w3.org/TR/2009/ED-css3-values-20090603</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-values">http://www.w3.org/TR/css3-values</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2005/WD-css3-values-20050726">http://www.w3.org/TR/2005/WD-css3-values-20050726</a>
<dt>Editors:
<dd>Håkon Wium Lie, Opera Software <howcome@opera.com>
<dd>Chris Lilley, W3C <chris@w3.org>
</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>
<!--
[css3-values] cycle() values?
From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 30 Mar 2006 01:20:00 -0800
I'd like to resurrect an old proposal for addition to css3-values [1]:
http://lists.w3.org/Archives/Public/www-style/1999May/0067
http://lists.w3.org/Archives/Public/www-style/1999Jun/0026
This is particularly useful for styling HTML's UL and EM elements.
Proposed text that could be used in the specification is the following:
=====
The cycle() expression allows descendant elements to cycle over a list
of values instead of inheriting the same value. The syntax of the
cycle() expression is:
cycle( <value> [, <value> ]*)
where <value> is a CSS value that is valid where the expression is
placed. If any of the values inside are not valid, then the entire
cycle() expression is invalid.
The value returned by cycle() must be determined by comparing the
inherited value I (the computed value on the parent, or, for the root,
the initial value) to the computed values C[n] returned by the n-th
argument to cycle(). For the earliest C[n] such that C[n] == I, the
value returned by cycle is C[n+1]. However, if this C[n] is the last
value, or if there are no C[n] that equal I, the computed value of the
first value is returned instead.
Example 1:
/* make em elements italic, but make them normal if they're inside
something that's italic */
em { font-style: cycle(italic, normal); }
Example 2:
/* cycle between markers for nested lists, so that the top level has
disk markers, but nested lists use circle, square, box, and then
(for the 5th list deep) repeat */
ul { list-style-type: disk; }
li > ul { list-style-type: cycle(disk, circle, square, box); }
=====
It could also be used in other interesting ways -- probably some bizarre
ones that I haven't even thought of yet. Although I admit I have
already thought of:
list-style-type: cycle(cycle(disc,disc,circle,circle), cycle(disc,circle),
cycle(square,square,box,box), cycle(square,box));
Understanding this is left as an exercise to the reader.
=======================================================
http://lists.w3.org/Archives/Public/www-style/2009Mar/0065.html
- RESOLVED: URLs inside functional notation where URL is expected should be able
to take either url() or bare strings (like @import), preference for
examples is bare strings.
-->
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>This CSS3 module describes the various values and units that CSS
properties accept. Also, it describes how values are computed from
"specified" through "computed" and "used" into "actual" values. The main
purpose of this module is to define common values and units in one
specification which can be referred to by other modules. As such, it does
not make sense to claim conformance with this module alone.
<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-values” in the subject, preferably like this:
“[<!---->css3-values<!---->] <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-->
<p>All features described in this specification that also exist in CSS 2.1
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> are intended
to be backwards compatible. In case of conflict between this draft and
CSS 2.1 <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, CSS 2.1 probably
represents the intention of the CSS WG better than this draft (other than
on values and units that are new to CSS3).
<p>This is a draft of a <a href="http://www.w3.org/TR/css3-roadmap/">module
of CSS level 3</a>. It will probably be bundled with some other modules
before it becomes a <a href="http://www.w3.org/TR/#About">W3C
Recommendation</a>.
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#dependencies-on-other-modules"><span class=secno>1
</span>Dependencies on other modules</a>
<li><a href="#introduction"><span class=secno>2 </span>Introduction</a>
<li><a href="#value-definitions"><span class=secno>3 </span>Value
definitions</a>
<li><a href="#syntax-and-terminology"><span class=secno>4 </span>Syntax
and terminology</a>
<ul class=toc>
<li><a href="#integers"><span class=secno>4.1 </span>Integers</a>
<li><a href="#numbers"><span class=secno>4.2 </span>Numbers</a>
<li><a href="#numbers-with-unit-identifiers"><span class=secno>4.3
</span>Numbers with unit identifiers</a>
<li><a href="#identifiers"><span class=secno>4.4 </span>Identifiers</a>
<li><a href="#strings"><span class=secno>4.5 </span>Strings</a>
<li><a href="#functional-notation"><span class=secno>4.6
</span>Functional notation</a>
<li><a href="#cycle-function"><span class=secno>4.7 </span>Cycle
function</a>
</ul>
<li><a href="#keywords"><span class=secno>5 </span>Keywords</a>
<li><a href="#generic-data-types"><span class=secno>6 </span>Generic data
types</a>
<ul class=toc>
<li><a href="#ltintegergt"><span class=secno>6.1
</span><integer></a>
<li><a href="#ltnumbergt"><span class=secno>6.2
</span><number></a>
<li><a href="#ltlengthgt-"><span class=secno>6.3 </span><length>
</a>
<ul class=toc>
<li><a href="#absolute-length-units-cm-mm.-in-pt-pc"><span
class=secno>6.3.1 </span>Absolute length units: cm, mm. in, pt,
pc</a>
<li><a href="#relative-length-units"><span class=secno>6.3.2
</span>Relative length units</a>
<ul class=toc>
<li><a href="#the-em-unit"><span class=secno>6.3.2.1. </span>The
‘<code class=property>em</code>’ unit</a>
<li><a href="#the-ex-unit"><span class=secno>6.3.2.2. </span>The
‘<code class=property>ex</code>’ unit</a>
<li><a href="#the-px-unit"><span class=secno>6.3.2.3. </span>The
‘<code class=property>px</code>’ unit</a>
<li><a href="#the-rem-unit"><span class=secno>6.3.2.4. </span>The
‘<code class=property>rem</code>’ unit</a>
<li><a href="#the-vw-unit"><span class=secno>6.3.2.5. </span>The
‘<code class=property>vw</code>’ unit</a>
<li><a href="#the-vh-unit"><span class=secno>6.3.2.6. </span>The
‘<code class=property>vh</code>’ unit</a>
<li><a href="#the-vm-unit"><span class=secno>6.3.2.7. </span>The
‘<code class=property>vm</code>’ unit</a>
</ul>
<li><a href="#the-calc-function"><span class=secno>6.3.3 </span>The
‘<code class=property>calc</code>’ function</a>
</ul>
<li><a href="#ltstringgt"><span class=secno>6.4
</span><string></a>
<li><a href="#ltcolorgt"><span class=secno>6.5 </span><color></a>
<li><a href="#ltpercentagegt-"><span class=secno>6.6
</span><percentage> </a>
<li><a href="#ltanglegt-"><span class=secno>6.7 </span><angle>
</a>
<li><a href="#lttimegt"><span class=secno>6.8 </span><time></a>
<li><a href="#ltfrequencygt"><span class=secno>6.9
</span><frequency></a>
<li><a href="#ltattrgt"><span class=secno>6.10 </span><attr></a>
<li><a href="#uris"><span class=secno>6.11 </span><url></a>
<li><a href="#ltimagegt"><span class=secno>6.12 </span><image></a>
<li><a href="#ltfractiongt"><span class=secno>6.13
</span><fraction></a>
<ul class=toc>
<li><a href="#the-fr-unit"><span class=secno>6.13.1 </span>The
‘<code class=property>fr</code>’ unit</a>
</ul>
<li><a href="#ltgridgt"><span class=secno>6.14 </span><grid></a>
<ul class=toc>
<li><a href="#the-gr-unit"><span class=secno>6.14.1 </span>The
‘<code class=property>gr</code>’ unit</a>
</ul>
</ul>
<li><a href="#specified-computed-used-and-actual-value"><span
class=secno>7 </span>Specified, computed, used, and actual values</a>
<ul class=toc>
<li><a href="#finding-the-specified-value"><span class=secno>7.1
</span>Finding the specified value</a>
<li><a href="#finding-the-computed-value"><span class=secno>7.2
</span>Finding the computed value</a>
<li><a href="#finding-the-used-value"><span class=secno>7.3
</span>Finding the used value</a>
<li><a href="#finding-the-actual-value"><span class=secno>7.4
</span>Finding the actual value</a>
</ul>
<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="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<h2 id=dependencies-on-other-modules><span class=secno>1
</span>Dependencies on other modules</h2>
<p>This CSS3 module depends on the following other CSS3 modules:
<ul>
<li><cite>Cascading and Inheritance</cite> <a href="#CSS3CASCADE"
rel=biblioentry>[CSS3CASCADE]<!--{{!CSS3CASCADE}}--></a>, which describes
how to find the <cite>resulting value</cite> from several competing
values. Also, it describes how to replace the "inherit" keyword with the
inherited value.
<li><cite>Syntax</cite> <a href="#CSS3SYN"
rel=biblioentry>[CSS3SYN]<!--{{!CSS3SYN}}--></a>, which describes the
syntax of values at the lexical level.
<li><cite>Color</cite> <a href="#CSS3COLOR"
rel=biblioentry>[CSS3COLOR]<!--{{!CSS3COLOR}}--></a>, which defines
additional values used for some properties that control color of text,
borders, etc
<li><cite>Fonts</cite> <a href="#CSS3FONT"
rel=biblioentry>[CSS3FONT]<!--{{!CSS3FONT}}--></a>, which describes
additional values used for font-related properties
</ul>
<h2 id=introduction><span class=secno>2 </span>Introduction</h2>
<p>By setting property values on elements in a document, style sheets
express the appearance of the document. In order to express rich designs,
a wide range of values and associated units are necessary. This
specifiction describes the various types of values and units that can be
used in CSS style sheets.
<h2 id=value-definitions><span class=secno>3 </span>Value definitions</h2>
<p>Each CSS property has a value definition field in the property
description. The value definition describes what types of values the
property accepts. The syntax used in the value definitions field is <a
href="http://www.w3.org/TR/css3-syntax/#property-def-value">defined</a> in
<a href="#CSS3SYN" rel=biblioentry>[CSS3SYN]<!--{{!CSS3SYN}}--></a>.
<div class=example>
<p>Here are some sample properties with corresponding value definition
fields:
<table>
<tbody>
<tr>
<th>Property
<th>Value definition field
<tr>
<td>min-width
<td><length> | <percentage> | inherit
<tr>
<td>outline-color
<td><color> | invert | inherit
<tr>
<td>orphans
<td><integer> | inherit
<tr>
<td>pitch
<td><frequency> | x-low | low | medium | high | x-high | inherit
<tr>
<td>string-set
<td>[[ <identifier> <content-list>] [, <identifier>
<content-list>]* ] | none
</table>
</div>
<p>The value definition fields contain keywords, data types (which appear
between "<" and ">", and information on how they can be combined. Generic
data types (<length> being the most widely used) that can be used by
many properties are described in this specification, while more specific
data types (e.g., <border-width>) are described in the corresponding
modules.
<h2 id=syntax-and-terminology><span class=secno>4 </span>Syntax and
terminology</h2>
<p>The generic data types described in the next sections use some common
syntactic building blocks and terms that are described in this section.
<h3 id=integers><span class=secno>4.1 </span>Integers</h3>
<p>An <dfn id=integer-is-one-or-more-decimal-digits-0->integer<dfn> is one
or more decimal digits "0" to "9". Integers may be preceded by "-" or "+"
to indicate the sign. </dfn></dfn>
<div class=example>
<pre>
orphans: 3
</pre>
</div>
<h3 id=numbers><span class=secno>4.2 </span>Numbers</h3>
<p>A <dfn id=number>number</dfn> is either an integer, or zero or more
decimal digits followed by a dot (.) followed by one or more decimal
digits. Numbers may be preceded by "-" or "+" to indicate the sign.
<div class=example>
<pre>
line-height: 1.2
</pre>
</div>
<h3 id=numbers-with-unit-identifiers><span class=secno>4.3 </span>Numbers
with unit identifiers</h3>
<p>A <dfn id=number-with-a-unit-identifier-is-a-numbe>number with a unit
identifier<dfn> is a number immediately followed by a unit identifier.
</dfn></dfn>
<div class=example>
<pre>
border-left: -1.2em
</pre>
</div>
<h3 id=identifiers><span class=secno>4.4 </span>Identifiers</h3>
<p>An <dfn id=identifer>identifer</dfn> is an seqence of characters.
Identifiers cannot start with a digit, and there are other restrictions <a
href="#CSS3SYN" rel=biblioentry>[CSS3SYN]<!--{{!CSS3SYN}}--></a> on what
characters an identifier can contain. Identifiers must not be quoted.
<div class=example>
<pre>
pitch-range: inherit;
counter-increment: header;
</pre>
</div>
<h3 id=strings><span class=secno>4.5 </span>Strings</h3>
<p>A <dfn id=string>string</dfn> is a sequence of characters enclosed by
double quotes or single quotes. Double quotes cannot occur inside double
quotes, unless escaped (as ‘<code class=css>\"</code>’ or as
‘<code class=css>\22</code>’). Analogously for single quotes
("\'" or "\27").<!--"-->