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
2310 lines (1765 loc) · 94.3 KB
/
Overview.html
File metadata and controls
2310 lines (1765 loc) · 94.3 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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!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=utf-8" http-equiv=Content-Type>
<title>CSS Values and Units Module Level 3</title>
<style type="text/css">
code, small { white-space: nowrap }
.say { color: gray; }
pre.value { font: inherit; white-space: pre-wrap; margin: 0; padding: 0; }
#propvalues td { text-align: right; }
#propvalues td + td { text-align: left; }
dt + dt::before { content: ", "; }
dt { display: inline; }
:not(code) var { font-style: normal; color: #005A9C; }
</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>CSS Values and Units Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 23 April 2012</h2>
<dl>
<dt>This version:
<dd><a
href="http://www.w3.org/TR/2012/ED-css3-values-20120423/">http://www.w3.org/TR/2012/ED-css3-values-20120423/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-values/">http://www.w3.org/TR/css3-values/</a>
<dt>Editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css3-values/">http://dev.w3.org/csswg/css3-values/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2011/WD-css3-values-20110906/">http://www.w3.org/TR/2011/WD-css3-values-20110906/</a>
<dt>Issue Tracking:
<dd><a
href="http://www.w3.org/Style/CSS/Tracker/products/33">http://www.w3.org/Style/CSS/Tracker/products/33</a>
<dt>Feedback:
<dd><a
href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
with subject line “<kbd>[css3-values] <var>… message topic
…</var></kbd>”
<dt>Editors:
<dd><a href="mailto:howcome@opera.com">Håkon Wium Lie</a> (Opera
Software)
<dd><a href="http://www.xanthir.com/contact">Tab Atkins</a> (Google)
<dd><a href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>
(Mozilla)
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></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 CSS3 module describes the common values and units that CSS
properties accept and the syntax used for describing them in CSS property
definitions.
<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?Subject=%5Bcss3-values%5D%20PUT%20SUBJECT%20HERE">
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>This specification is a <strong>Last Call Working Draft</strong>. All
persons are encouraged to review this document and <strong>send comments
to the <a
href="http://lists.w3.org/Archives/Public/www-style/">www-style</a>
mailing list</strong> as described above. The <strong>deadline for
comments</strong> is <strong>29 March 2012</strong>.
<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. If you notice a conflict between this draft
and CSS 2.1 <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, please inform the editors!
<p>The following features are at-risk and may be dropped during the CR
period: ‘<a href="#calc"><code class=css>calc()</code></a>’,
‘<a href="#cycle"><code class=css>cycle()</code></a>’,
‘<a href="#attr"><code class=css>attr()</code></a>’.
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#introduction"><span class=secno>1. </span>Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
Interactions</a>
</ul>
<li><a href="#value-defs"><span class=secno>2. </span> Value Definition
Syntax</a>
<ul class=toc>
<li><a href="#component-types"><span class=secno>2.1. </span> Component
value types</a>
<li><a href="#component-combinators"><span class=secno>2.2. </span>
Component value combinators</a>
<li><a href="#component-multipliers"><span class=secno>2.3. </span>
Component value multipliers</a>
<li><a href="#component-whitespace"><span class=secno>2.4. </span>
Component values and white space</a>
<li><a href="#value-examples"><span class=secno>2.5. </span> Property
value examples</a>
</ul>
<li><a href="#textual-values"><span class=secno>3. </span> Textual Data
Types</a>
<ul class=toc>
<li><a href="#keywords"><span class=secno>3.1. </span> Pre-defined
Keywords</a>
<ul class=toc>
<li><a href="#common-keywords"><span class=secno>3.1.1. </span>
CSS-wide keywords: ‘<code class=css>initial</code>’ and
‘<code class=css>inherit</code>’</a>
</ul>
<li><a href="#identifiers"><span class=secno>3.2. </span> User-defined
Identifiers: the ‘<code
class=css><identifier></code>’ type</a>
<li><a href="#strings"><span class=secno>3.3. </span> Quoted Strings:
the ‘<code class=css><string></code>’ type</a>
<li><a href="#urls"><span class=secno>3.4. </span> Resource Locators:
the ‘<code class=css><url></code>’ type</a>
</ul>
<li><a href="#numeric-types"><span class=secno>4. </span> Numeric Data
Types</a>
<ul class=toc>
<li><a href="#integers"><span class=secno>4.1. </span> Integers: the
‘<code class=css><integer></code>’ type</a>
<li><a href="#numbers"><span class=secno>4.2. </span> Numbers: the
‘<code class=css><number></code>’ type</a>
<li><a href="#percentages"><span class=secno>4.3. </span> Percentages:
the ‘<code class=css><percentage></code>’ type</a>
</ul>
<li><a href="#lengths"><span class=secno>5. </span> Distance Units: the
‘<code class=css><length></code>’ type</a>
<ul class=toc>
<li><a href="#relative-lengths"><span class=secno>5.1. </span> Relative
lengths</a>
<ul class=toc>
<li><a href="#font-relative-lengths"><span class=secno>5.1.1. </span>
Font-relative lengths: the ‘<code class=css>em</code>’,
‘<code class=css>ex</code>’, ‘<code
class=css>ch</code>’, ‘<code class=css>rem</code>’
units</a>
<li><a href="#viewport-relative-lengths"><span class=secno>5.1.2.
</span> Viewport-percentage lengths: the ‘<code
class=css>vw</code>’, ‘<code class=css>vh</code>’,
‘<code class=css>vmin</code>’ units</a>
</ul>
<li><a href="#absolute-lengths"><span class=secno>5.2. </span> Absolute
lengths: the ‘<code class=css>cm</code>’, ‘<code
class=css>mm</code>’, ‘<code class=css>in</code>’,
‘<code class=css>pt</code>’, ‘<code
class=css>pc</code>’, ‘<code class=css>px</code>’
units</a>
</ul>
<li><a href="#other-units"><span class=secno>6. </span> Other Units</a>
<ul class=toc>
<li><a href="#angles"><span class=secno>6.1. </span> Angles: the
‘<code class=css><angle></code>’ type and
‘<code class=css>deg</code>’, ‘<code
class=css>grad</code>’, ‘<code class=css>rad</code>’,
‘<code class=css>turn</code>’ units</a>
<li><a href="#time"><span class=secno>6.2. </span> Times: the
‘<code class=css><time></code>’ type and ‘<code
class=css>s</code>’, ‘<code class=css>ms</code>’
units</a>
<li><a href="#frequency"><span class=secno>6.3. </span> Frequencies: the
‘<code class=css><frequency></code>’ type and
‘<code class=css>Hz</code>’, ‘<code
class=css>kHz</code>’ units</a>
<li><a href="#resolution"><span class=secno>6.4. </span> Resolutions:
the <var><resolution></var> type and ‘<code
class=css>dpi</code>’, ‘<code class=css>dpcm</code>’,
‘<code class=css>dppx</code>’ units</a>
</ul>
<li><a href="#defined-elsewhere"><span class=secno>7. </span> Data Types
Defined Elsewhere</a>
<ul class=toc>
<li><a href="#colors"><span class=secno>7.1. </span> Colors: the
‘<code class=css><color></code>’ type</a>
<li><a href="#images"><span class=secno>7.2. </span> Images: the
‘<code class=css><image></code>’ type</a>
<li><a href="#position"><span class=secno>7.3. </span> 2D Positioning:
the ‘<code class=css><position></code>’ type</a>
</ul>
<li><a href="#functional-notation"><span class=secno>8. </span> Functional
Notations</a>
<ul class=toc>
<li><a href="#calc-notation"><span class=secno>8.1. </span> Mathematical
Expressions: ‘<code class=css>calc()</code>’</a>
<ul class=toc>
<li><a href="#calc-syntax"><span class=secno>8.1.1. </span> Syntax</a>
<li><a href="#calc-type-checking"><span class=secno>8.1.2. </span>
Type Checking</a>
<li><a href="#calc-range"><span class=secno>8.1.3. </span> Range
Checking</a>
</ul>
<li><a href="#cycle-notation"><span class=secno>8.2. </span> Cycling
Values: ‘<code class=css>cycle()</code>’</a>
<li><a href="#attr-notation"><span class=secno>8.3. </span> Attribute
References: ‘<code class=css>attr()</code>’</a>
</ul>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li><a href="#conformance"><span class=secno>9. </span> Conformance</a>
<ul class=toc>
<li><a href="#conventions"><span class=secno>9.1. </span> Document
conventions</a>
<li><a href="#conformance-classes"><span class=secno>9.2. </span>
Conformance classes</a>
<li><a href="#partial"><span class=secno>9.3. </span> Partial
implementations</a>
<li><a href="#experimental"><span class=secno>9.4. </span> Experimental
implementations</a>
<li><a href="#testing"><span class=secno>9.5. </span> Non-experimental
implementations</a>
<li><a href="#cr-exit-criteria"><span class=secno>9.6. </span> CR exit
criteria</a>
</ul>
<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=introduction><span class=secno>1. </span>Introduction</h2>
<p>The value definition field of each CSS property can contain keywords,
data types (which appear between ‘<code class=css><</code>’
and ‘<code class=css>></code>’), and information on how they
can be combined. Generic data types (<a
href="#length-value"><var><length></var></a> being the most widely
used) that can be used by many properties are described in this
specification, while more specific data types (e.g.,
<var><spacing-limit></var>) are described in the corresponding modules.
<h3 id=placement><span class=secno>1.1. </span> Module Interactions</h3>
<p>This module replaces and extends the data type definitions in <a
href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> sections <a
href="http://www.w3.org/TR/CSS21/about.html#value-defs">1.4.2.1</a>, <a
href="http://www.w3.org/TR/CSS21/syndata.html#values">4.3</a>, and <a
href="http://www.w3.org/TR/CSS21/aural.html#aural-intro">A.2</a>.
<h2 id=value-defs><span class=secno>2. </span> Value Definition Syntax</h2>
<p>The syntax described here is used to define the set of valid values for
CSS properties. A property value can have one or more components.
<h3 id=component-types><span class=secno>2.1. </span> Component value types</h3>
<p>Component value types are designated in several ways:
<ol>
<li><a href="#keywords">keyword</a> values (such as ‘<code
class=css>auto</code>’, ‘<code class=css>disc</code>’,
etc.), which appear literally, without quotes (e.g. <code>auto</code>)
<li>basic data types, which appear between ‘<code
class=css><</code>’ and ‘<code
class=css>></code>’ (e.g., <a
href="#length-value"><var><length></var></a>, <a
href="#percentage-value"><var><percentage></var></a>, etc.).
<li>types that have the same range of values as a property bearing the
same name (e.g., <var><‘<code
class=property>border-width</code>’></var> <var><‘<code
class=property>background-attachment</code>’></var>, etc.). In
this case, the type name is the property name (complete with quotes)
between the brackets. Such a type does <em>not</em> include <a
href="#common-keywords">CSS-wide keywords</a> such as ‘<code
class=css>inherit</code>’.
<li>non-terminals that do not share the same name as a property. In this
case, the non-terminal name appears between ‘<code
class=css><</code>’ and ‘<code
class=css>></code>’, as in <var><spacing-limit></var>. Notice
the distinction between <var><border-width></var> and
<var><‘<code
class=property>border-width</code>’></var>: the latter is
defined as the value of the ‘<code
class=property>border-width</code>’ property, the former requires
an explicit expansion elsewhere. The definition of a non-terminal is
located near its first appearance in the specification.
</ol>
<p>Some property value definitions also include the slash (/) and/or the
comma (,) as literals. These represent their corresponding tokens.
<p>All CSS properties also accept the keyword values ‘<code
class=css>inherit</code>’ and ‘<code
class=css>initial</code>’ as their property value, but for
readability these are not listed explicitly in the property value syntax
definitions. These keywords cannot be combined with other component values
in same declaration; such a declaration is invalid. For example,
‘<code class=css>background: url(corner.png) no-repeat,
inherit;</code>’ is invalid.
<h3 id=component-combinators><span class=secno>2.2. </span> Component value
combinators</h3>
<p>Component values can be arranged into property values as follows:
<ul>
<li>Several juxtaposed words mean that all of them must occur, in the
given order.
<li>A double ampersand (&&) separates two or more components, all of which
must occur, in any order.
<li>A double bar (||) separates two or more options: one or more of them
must occur, in any order.
<li>A bar (|) separates two or more alternatives: exactly one of them must
occur.
<li>Brackets ([ ]) are for grouping.
</ul>
<p>Juxtaposition is stronger than the double ampersand, the double
ampersand is stronger than the double bar, and the double bar is stronger
than the bar. Thus, the following lines are equivalent:
<pre>
<!----> a b | c || d && e f
<!---->[ a b ] | [ c || [ d && [ e f ]]]</pre>
<h3 id=component-multipliers><span class=secno>2.3. </span> Component value
multipliers</h3>
<p>Every type, keyword, or bracketed group may be followed by one of the
following modifiers:
<ul>
<li>An asterisk (*) indicates that the preceding type, word, or group
occurs zero or more times.
<li>A plus (+) indicates that the preceding type, word, or group occurs
one or more times.
<li>A question mark (?) indicates that the preceding type, word, or group
is optional.
<li>A pair of numbers in curly braces ({<var>A</var>,<var>B</var>})
indicates that the preceding type, word, or group occurs at least
<var>A</var> and at most <var>B</var> times.
<li>A hash mark (#) indicates that the preceding type, word, or group
occurs one or more times, separated by comma tokens.
</ul>
<p>For repeated component values (indicated by ‘<code
class=css>*</code>’, ‘<code class=css>+</code>’, or
‘<code class=css>#</code>’), UAs must support at least 20
repetitions of the component. If a property value contains more than the
supported number of repetitions, the declaration must be ignored as if it
were invalid.
<h3 id=component-whitespace><span class=secno>2.4. </span> Component values
and white space</h3>
<p>Component values are specified in terms of tokens, as described in <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">Chapter 4</a>
of <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. As the
grammar allows spaces between tokens in the components of the
<code>value</code> production, spaces may appear between tokens in
property values.
<p class=note>Note: In many cases, spaces will in fact be <em>required</em>
between tokens in order to distinguish them from each other. For example,
the value ‘<code class=css>1em2em</code>’ would be parsed as a
single <code>DIMEN</code> token with the number ‘<code
class=css>1</code>’ and the identifier ‘<code
class=css>em2em</code>’, which is an invalid unit. In this case, a
space would be required before the ‘<code class=css>2</code>’
to get this parsed as the two lengths ‘<code
class=css>1em</code>’ and ‘<code class=css>2em</code>’.
<h3 id=value-examples><span class=secno>2.5. </span> Property value
examples</h3>
<p>Below are some examples of properties with their corresponding value
definition fields
<div class=example>
<table class=data id=propvalues>
<thead>
<tr>
<th>Property
<th>Value definition field
<th>Example value
<tbody>
<tr>
<td>‘<code class=property>orphans</code>’
<td><integer>
<td>‘<code class=css>3</code>’
<tr>
<td>‘<code class=property>text-align</code>’
<td>left | right | center | justify
<td>‘<code class=css>center</code>’
<tr>
<td>‘<code class=property>padding-top</code>’
<td><length> | <percentage>
<td>‘<code class=css>5%</code>’
<tr>
<td>‘<code class=property>outline-color</code>’
<td><color> | invert
<td>‘<code class=css>#fefefe</code>’
<tr>
<td>‘<code class=property>text-decoration</code>’
<td>none | underline || overline || line-through || blink
<td>‘<code class=css>overline underline</code>’
<tr>
<td>‘<code class=property>font-family</code>’
<td><family-name>#
<td>‘<code class=css>"Gill Sans", Futura,
sans-serif</code>’
<tr>
<td>‘<code class=property>border-width</code>’
<td>[ <length> | thick | medium | thin ]{1,4}
<td>‘<code class=css>2px medium 4px</code>’
<tr>
<td>‘<code class=property>text-shadow</code>’
<td>[ inset? && [ <length>{2,4} && <color>? ] ]# | none
<td>‘<code class=css>3px 3px rgba(50%, 50%, 50%, 50%),
lemonchiffon 0 0 4px inset</code>’
<tr>
<td>‘<code class=property>voice-pitch</code>’
<td>
<pre class=value><frequency> && absolute |
<!-- -->[[x-low | low | medium | high | x-high] ||
<!-- --> [<frequency> | <semitones> | <percentage>]]</pre>
<td>‘<code class=css>-2st x-low</code>’
</table>
</div>
<h2 id=textual-values><span class=secno>3. </span> Textual Data Types</h2>
<p>An <dfn id=identifier>identifier</dfn> is a sequence of characters
conforming to the <code>IDENT</code> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Identifiers
cannot be quoted; otherwise they would be interpreted as a string.
<h3 id=keywords><span class=secno>3.1. </span> Pre-defined Keywords</h3>
<p>In the value definition fields, keywords with a pre-defined meaning
appear literally. Keywords are CSS <a
href="#identifier"><i>identifiers</i></a> and are interpreted
case-insensitively within the ASCII range (i.e., [a-z] and [A-Z] are
equivalent).
<div class=example>
<p>For example, here is the value definition for the ‘<code
class=property>border-collapse</code>’ property:</p>
<pre>Value: collapse | separate</pre>
<p>And here is an example of its use:</p>
<pre>table { border-collapse: separate }</pre>
</div>
<h4 id=common-keywords><span class=secno>3.1.1. </span> CSS-wide keywords:
‘<code class=css>initial</code>’ and ‘<code
class=css>inherit</code>’</h4>
<p>As defined <a href="#component-types">above</a>, all properties accept
the ‘<code class=css>initial</code>’ and ‘<code
class=css>inherit</code>’ keywords, which represent value
computations common to all CSS properties.
<p>The <dfn id=inherit>‘<code class=css>inherit</code>’</dfn>
keyword is <a
href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">defined</a>
in <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
<p>The <dfn id=initial>‘<code class=css>initial</code>’</dfn>
keyword represents the specified value that is designated as the
property's initial value. <a href="#CSS3CASCADE"
rel=biblioentry>[CSS3CASCADE]<!--{{CSS3CASCADE}}--></a>
<h3 id=identifiers><span class=secno>3.2. </span> User-defined Identifiers:
the ‘<code class=css><identifier></code>’ type</h3>
<p>Some properties accept arbitrary user-defined identifiers as a component
value. This generic data type is denoted by <dfn
id=identifier-value><var><identifier></var></dfn>, and represents any
valid CSS <a href="#identifier"><i>identifier</i></a> that does not
otherwise appear as a pre-defined keyword in that property's value
definition. Such identifiers are fully case-sensitive, even in the ASCII
range (e.g. ‘<code class=css>example</code>’ and ‘<code
class=css>EXAMPLE</code>’ are two different, unrelated user-defined
identifiers).
<h3 id=strings><span class=secno>3.3. </span> Quoted Strings: the
‘<code class=css><string></code>’ type</h3>
<p>Strings are denoted by <dfn id=string-value><var><string></var></dfn>
and consist of a sequence of characters delimited by double quotes or
single quotes. They correspond to the <code>STRING</code> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
<div class=example>
<p>Double quotes cannot occur inside double quotes, unless escaped (as
<code>"\""</code> or as <code>"\22"</code>). Analogously for single
quotes (<code>'\''</code> or <code>'\27'</code>).
<pre>
<!-- -->content: "this is a 'string'.";
<!-- -->content: "this is a \"string\".";
<!-- -->content: 'this is a "string".';
<!-- -->content: 'this is a \'string\'.';</pre>
</div>
<p>It is possible to break strings over several lines, for aesthetic or
other reasons, but in such a case the newline itself has to be escaped
with a backslash (\). The newline is subsequently removed from the string.
For instance, the following two selectors are exactly the same:
<div class=example>
<p style="display:none">Example(s):</p>
<pre>
<!-- -->a[title="a not s\
<!-- -->o very long title"] {/*...*/}
<!-- -->a[title="a not so very long title"] {/*...*/}</pre>
</div>
<p>Since a string cannot directly represent a newline, to include a newline
in a string, use the escape "\A". (Hexadecimal A is the line feed
character in Unicode (U+000A), but represents the generic notion of
"newline" in CSS.)
<h3 id=urls><span class=secno>3.4. </span> Resource Locators: the
‘<code class=css><url></code>’ type</h3>
<p>A <dfn id=url>URL</dfn> is a pointer to a resource and is a <a
href="http://www.w3.org/TR/CSS21/syndata.html#uri">specially-parsed</a> <a
href="#functional-notation">functional notation</a> denoted by <dfn
id=url-value><var><url></var></dfn>. It corresponds to the
<code>URI</code> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
<div class=example>
<p>Below is an example of a URL being used as a background image:
<pre>body { background: url("http://www.example.com/pinkish.gif") }</pre>
<p>The same example can be written without quotes:
<pre>body { background: url(http://www.example.com/pinkish.gif) }</pre>
</div>
<p class=note>Note that in some CSS syntactic contexts (as defined by that
context), a URL can be represented as a <a
href="#string-value"><var><string></var></a> rather than by <a
href="#url-value"><var><URL></var></a>. An example of this is the <a
href="http://www.w3.org/TR/CSS21/cascade.html#at-import">‘<code
class=css>@import</code>’ rule</a>.
<p>Parentheses, whitespace characters, single quotes (') and double
quotes (") appearing in a URL must be escaped with a backslash so that the
resulting value is a valid <a href="#url"><code>URL</code></a> token, e.g.
‘<code class=css>url(open\(parens)</code>’, ‘<code
class=css>url(close\)parens)</code>’. Depending on the type of URL,
it might also be possible to write these characters as URI-escapes (e.g.
‘<code class=css>url(open%28parens)</code>’ or ‘<code
class=css>url(close%29parens)</code>’) as described in <a
href="#URI" rel=biblioentry>[URI]<!--{{URI}}--></a>. Alternatively a URL
containing such characters may be represented as a quoted <a
href="#strings">string</a> within the ‘<a href="#url"><code
class=css>url()</code></a>’ notation.
<p>In order to create modular style sheets that are not dependent on the
absolute location of a resource, authors should use relative URIs.
Relative URIs (as defined in <a href="#URI"
rel=biblioentry>[URI]<!--{{URI}}--></a>) are resolved to full URIs using a
base URI. RFC 3986, section 3, defines the normative algorithm
for this process. For CSS style sheets, the base URI is that of the style
sheet, not that of the source document.
<p>When a <i><url></i> appears in the computed value of a property,
it is resolved to an absolute URL, as described in the preceding
paragraph.
<div class=example>
<p>For example, suppose the following rule:
<pre>body { background: url("tile.png") }</pre>
<p>is located in a style sheet designated by the URL:</p>
<pre>http://www.example.org/style/basic.css</pre>
<p>The background of the source document's <var><body></var> will be
tiled with whatever image is described by the resource designated by the
URL:
<pre>http://www.example.org/style/tile.png</pre>
<p>The same image will be used regardless of the URL of the source
document containing the <var><body></var>.
</div>
<h2 id=numeric-types><span class=secno>4. </span> Numeric Data Types</h2>
<p> Properties may restrict numeric values to some range. If the value is
outside the allowed range, the declaration is invalid and must be <a
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>. For
unrestricted values, UAs must support at least up to ±2<sup>27</sup>-1;
unsupported values must be clamped to the closest supported value. When
arithmetic is performed with numeric types (for example, in the calc()
expression, or when doing unit conversions), if the result is outside the
UAs's supported range, it must also be clamped to the closest supported
value.
<p> UAs must support at least 3 digits of precision after the decimal point
in numeric values.
<h3 id=integers><span class=secno>4.1. </span> Integers: the ‘<code
class=css><integer></code>’ type</h3>
<p>Integer values are denoted by <dfn
id=integer-value><var><integer></var></dfn>. An <dfn
id=integer>integer</dfn> is one or more decimal digits ‘<code
class=css>0</code>’ through ‘<code class=css>9</code>’
and corresponds to a subset of the <a
href="#number"><code>NUMBER</code></a> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
Integers may be immediately preceded by ‘<code
class=css>-</code>’ or ‘<code class=css>+</code>’ to
indicate the sign.
<h3 id=numbers><span class=secno>4.2. </span> Numbers: the ‘<code
class=css><number></code>’ type</h3>
<p>Number values are denoted by <dfn
id=number-value><var><number></var></dfn>. A <dfn
id=number>number</dfn> is either an <a
href="#integer-value"><var><integer></var></a>, or zero or more decimal
digits followed by a dot (.) followed by one or more decimal digits. It
corresponds to the <a href="#number"><code>NUMBER</code></a> token in the
<a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
Like integers, numbers may also be immediately preceded by ‘<code
class=css>-</code>’ or ‘<code class=css>+</code>’ to
indicate the sign.
<h3 id=percentages><span class=secno>4.3. </span> Percentages: the
‘<code class=css><percentage></code>’ type</h3>
<p>A <dfn id=percentage>percentage</dfn> value is denoted by <dfn
id=percentage-value><var><percentage></var></dfn>, consists of a
<i><number></i> immediately followed by a percent sign ‘<code
class=css>%</code>’. It corresponds to the <a
href="#percentage"><code>PERCENTAGE</code></a> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
<p>Percentage values are always relative to another value, for example a
length. Each property that allows percentages also defines the value to
which the percentage refers. The value may be that of another property for
the same element, a property for an ancestor element, or a value of the
formatting context (e.g., the width of a <i>containing block</i>). When a
percentage value is set for a property of the <i>root</i> element and the
percentage is defined as referring to the inherited value of some
property, the resultant value is the percentage times the <i>initial
value</i> of that property.
<h2 id=lengths><span class=secno>5. </span> Distance Units: the
‘<code class=css><length></code>’ type</h2>
<p>Lengths refer to distance measurements and are denoted by <dfn
id=length-value><var><length></var></dfn> in the property definitions.
A length is a <a href="#dimension"><i>dimension</i></a>. A zero length may
be represented instead as the <a
href="#number-value"><var><number></var></a> ‘<code
class=css>0</code>’. (In other words, for zero lengths the unit
identifier is optional.)
<p>A <dfn id=dimension>dimension</dfn> is a <a
href="#number"><i>number</i></a> immediately followed by a unit
identifier. It corresponds to the <a
href="#dimension"><code>DIMENSION</code></a> token in the <a
href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">grammar</a>.
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> Like
keywords, unit identifiers are case-insensitive within the ASCII range.
<p>Properties may restrict the length value to some range. If the value is
outside the allowed range, the declaration is invalid and must be <a
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
<p>While some properties allow negative length values, this may complicate
the formatting and there may be implementation-specific limits. If a
negative length value is allowed but cannot be supported, it must be
converted to the nearest value that can be supported.
<p>In cases where the <!--FIXME: href--><a>used</a> length cannot be
supported, user agents must approximate it in the
<!--FIXME: href--><a>actual</a> value.
<p>There are two types of length units: relative and absolute.
<h3 id=relative-lengths><span class=secno>5.1. </span> Relative lengths</h3>
<p><dfn id=relative-length-units title="relative length">Relative length
units</dfn> specify a length relative to another length. Style sheets that
use relative units can more easily scale from one output environment to
another.
<p>The relative units are:
<table class=data>
<caption>Informative Summary of Relative Units</caption>
<thead>
<tr>
<th>unit
<th>relative to
<tbody>
<tr>
<td>‘<a href="#em-unit"><code class=css>em</code></a>’
<td>font size of the element
<tr>
<td>‘<a href="#ex-unit"><code class=css>ex</code></a>’
<td><i>x-height</i> of the element's font
<tr>
<td>‘<a href="#ch-unit"><code class=css>ch</code></a>’
<td>width of the "0" (ZERO, U+0030) glyph in the element's font
<tr>
<td>‘<a href="#rem-unit"><code class=css>rem</code></a>’
<td>font size of the root element
<tr>
<td>‘<a href="#vw-unit"><code class=css>vw</code></a>’
<td>viewport's width
<tr>
<td>‘<a href="#vh-unit"><code class=css>vh</code></a>’
<td>viewport's height
<tr>
<td>‘<a href="#vmin-unit"><code class=css>vmin</code></a>’
<td>minimum of the viewport's height and width
</table>
<p>Child elements do not inherit the relative values as specified for their
parent; they inherit the <!--FIXME: href--><a>computed values</a>.
<h4 id=font-relative-lengths><span class=secno>5.1.1. </span> Font-relative
lengths: the ‘<a href="#em-unit"><code
class=css>em</code></a>’, ‘<a href="#ex-unit"><code
class=css>ex</code></a>’, ‘<a href="#ch-unit"><code
class=css>ch</code></a>’, ‘<a href="#rem-unit"><code
class=css>rem</code></a>’ units</h4>
<p>Aside from ‘<a href="#rem-unit"><code
class=css>rem</code></a>’ (which refers to the font-size of the root
element), the font-relative lengths refer to the computed font metrics of
the element on which they are used. The exception is when they occur in
the value of the ‘<code class=property>font-size</code>’
property itself, in which case they refer to the computed font metrics of
the parent element (or the computed font metrics corresponding to the
initial values of the ‘<code class=property>font</code>’
property, if the element has no parent).
<dl>
<dt><dfn id=em-unit title=em>em unit</dfn>
<dd>
<p>Equal to the computed value of the ‘<code
class=property>font-size</code>’ property of the element on which
it is used.
<div class=example>
<p>The rule:</p>
<pre>h1 { line-height: 1.2em }</pre>
<p>means that the line height of <code>h1</code> elements will be 20%
greater than the font size of <code>h1</code> element. On the other
hand:
<pre>h1 { font-size: 1.2em }</pre>
<p>means that the font size of <code>h1</code> elements will be 20%
greater than the computed font size inherited by <code>h1</code>
elements.</p>
</div>
<dt><dfn id=ex-unit title=ex>ex unit</dfn>
<dd>
<p>Equal to the font's x-height. The x-height is so called because it is
often equal to the height of the lowercase "x". However, an ‘<a
href="#ex-unit"><code class=css>ex</code></a>’ is defined even for
fonts that do not contain an "x".
<p>The x-height of a font can be found in different ways. Some fonts
contain reliable metrics for the x-height. If reliable font metrics are
not available, UAs may determine the x-height from the height of a
lowercase glyph. One possible heuristic is to look at how far the glyph
for the lowercase "o" extends below the baseline, and subtract that
value from the top of its bounding box. In the cases where it is
impossible or impractical to determine the x-height, a value of 0.5em
must be assumed.
<dt><dfn id=ch-unit title=ch>ch unit</dfn>
<dd>
<p>Equal to the advance measure of the "0" (ZERO, U+0030) glyph found in
the font used to render it.
<dt><dfn id=rem-unit title=rem>rem unit</dfn>
<dd>
<p>Equal to the computed value of ‘<code
class=property>font-size</code>’ on the root element.
<p>When specified on the ‘<code
class=property>font-size</code>’ property of the root element, the
‘<a href="#rem-unit"><code class=css>rem</code></a>’ units
refer to the property's <em>initial value</em>.</p>
</dl>
<h4 id=viewport-relative-lengths><span class=secno>5.1.2. </span>
Viewport-percentage lengths: the ‘<a href="#vw-unit"><code
class=css>vw</code></a>’, ‘<a href="#vh-unit"><code
class=css>vh</code></a>’, ‘<a href="#vmin-unit"><code
class=css>vmin</code></a>’ units</h4>
<p>The viewport-percentage lengths are relative to the size of the initial
containing block. When the height or width of the viewport is changed,
they are scaled accordingly.
<dl>
<dt><dfn id=vw-unit title=vw>vw unit</dfn>
<dd>Equal to 1% of the width of the initial containing block.
<div class=example>
<p>In the example below, if the width of the viewport is 200mm, the font