-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
2592 lines (2005 loc) · 106 KB
/
Overview.html
File metadata and controls
2592 lines (2005 loc) · 106 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 profile="http://dublincore.org/documents/2008/08/04/dc-html/ ">
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Values and Units Module Level 3</title>
<link href="http://purl.org/dc/terms/" rel=schema.dc>
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=dc.rights>
<meta content="CSS Values and Units Module Level 3" name=dc.title>
<meta content=text name=dc.type>
<meta content=2013-04-04 name=dc.date>
<meta content="Håkon Wium Lie" name=dc.creator>
<meta content="Tab Atkins" name=dc.creator>
<meta content="Elika J. Etemad" name=dc.creator>
<meta content=W3C name=dc.publisher>
<meta content="http://www.w3.org/TR/2013/CR-css3-values-20130404/"
name=dc.identifier>
<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; }
td > small { display: block; }
</style>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<link href="http://www.w3.org/StyleSheets/TR/W3C-CR.css" rel=stylesheet
type="text/css">
<body class=h-entry>
<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 class=p-name>CSS Values and Units Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>W3C Candidate Recommendation
<span class=dt-updated><span class=value title=20130404>4 April
2013</span></span></h2>
<dl>
<dt>This version:
<dd><a class=u-url
href="http://www.w3.org/TR/2013/CR-css3-values-20130404/">http://www.w3.org/TR/2013/CR-css3-values-20130404/</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/2012/CR-css3-values-20120828/"
rel=previous>http://www.w3.org/TR/2012/CR-css3-values-20120828/</a>
<dt>Issue Tracking:
<dd><a href="http://www.w3.org/Style/CSS/Tracker/products/33"
rel=issues>http://www.w3.org/Style/CSS/Tracker/products/33</a>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5Bcss3-values%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css3-values] <var>… message topic
…</var></kbd>” (<a
href="http://lists.w3.org/Archives/Public/www-style/"
rel=discussion>archives</a>)
<dt>Editors:
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="mailto:howcome@opera.com" rel=author>Håkon Wium Lie</a> (<span
class="p-org org">Opera Software</span>)
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="http://www.xanthir.com/contact" rel=author>Tab Atkins</a> (<span
class="p-org org">Google</span>)
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="http://fantasai.inkedblade.net/contact" rel=author>Elika J.
Etemad</a> (<span class="p-org org">Mozilla</span>)
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2013 <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>, <a
href="http://ev.buaa.edu.cn/">Beihang</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><span class=p-summary>This CSS3 module describes the common values and
units that CSS properties accept and the syntax used for describing them
in CSS property definitions.</span>
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index at http://www.w3.org/TR/.</a></em>
<p>This document was produced by the <a
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> as a <a
href="http://www.w3.org/Consortium/Process/tr#RecsCR">Candidate
Recommendation.</a>
<p>A Candidate Recommendation is a document that has been widely reviewed
and is ready for implementation. W3C encourages everybody to implement
this specification and return comments to 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>). When sending
e-mail, please put the text “css3-values” in the subject, preferably
like this: “[<!---->css3-values<!---->] <em>…summary of
comment…</em>”
<p>Publication as a Candidate Recommendation does not imply endorsement by
the W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time. It is inappropriate to cite
this document as other than work in progress.
<p>This document was produced by a group operating under the <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</a>. W3C maintains a <a
href="http://www.w3.org/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="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance with <a
href="http://www.w3.org/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. 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 CR period will last at least until 4 May 2013. At the time of
publication, no test suite and implementation report have yet been made.
They will be made available from the <a href="/Style/CSS/Test/">CSS test
suites page.</a> See the section <a href="#cr-exit-criteria">“CR exit
criteria”</a> for details.
<p>See the section <a href="#changes">“Changes”</a> for changes made to
this specification since the last Candidate Recommendation.
<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="#toggle"><code class=css>toggle()</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>
<li><a href="#custom-idents"><span class=secno>3.1.2. </span>
Author-defined Identifiers: the ‘<code
class=css><custom-ident></code>’ type</a>
</ul>
<li><a href="#strings"><span class=secno>3.2. </span> Quoted Strings:
the ‘<code class=css><string></code>’ type</a>
<li><a href="#urls"><span class=secno>3.3. </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>’, ‘<code class=css>vmax</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-computed-value"><span class=secno>8.1.3. </span>
Computed Value</a>
<li><a href="#calc-range"><span class=secno>8.1.4. </span> Range
Checking</a>
</ul>
<li><a href="#toggle-notation"><span class=secno>8.2. </span> Toggling
Between Values: ‘<code class=css>toggle()</code>’</a>
<li><a href="#attr-notation"><span class=secno>8.3. </span> Attribute
References: ‘<code class=css>attr()</code>’</a>
</ul>
<li><a href="#iana"><span class=secno>9. </span> Appendix A: IANA
Considerations</a>
<ul class=toc>
<li><a href="#about-invalid"><span class=secno>9.1. </span> Registration
for the <code>about:invalid</code> URL scheme</a>
</ul>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#conformance"> Conformance</a>
<ul class=toc>
<li class=no-num><a href="#conventions"> Document conventions</a>
<li class=no-num><a href="#conformance-classes"> Conformance classes</a>
<li class=no-num><a href="#partial"> Partial implementations</a>
<li class=no-num><a href="#experimental"> Experimental
implementations</a>
<li class=no-num><a href="#testing"> Non-experimental
implementations</a>
<li class=no-num><a href="#cr-exit-criteria"> CR exit criteria</a>
</ul>
<li class=no-num><a href="#changes">Changes</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=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 ‘<a
href="#lsquoinheritrsquo"><code class=css>inherit</code></a>’.
<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 <a href="#common-keywords">CSS-wide
keyword values</a> ‘<a href="#lsquoinheritrsquo"><code
class=css>inherit</code></a>’ and ‘<a href="#lsquoinitialrsquo"><code
class=css>initial</code></a>’ as the sole component of their property
value. For readability these are not listed explicitly in the property
value syntax definitions. For example, the full value definition of <a
href="http://www.w3.org/TR/css3-background/#border-color">‘<code
class=property>border-color</code>’</a> is ‘<code class=css>[
<color>{1,4} ] | inherit | initial</code>’ (even though it is listed
as ‘<code class=css><color>{1,4}</code>’).
<p class=note> Note: This implies that, in general, combining these
keywords with other component values in the same declaration results in an
invalid declaration. 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>
<!--
<p>
White space is allowed, but optional, between components of a combination.
-->
<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>
White space is allowed, but optional, between repetitions
and around the comma separator of ''#''-multiplied lists.
-->
<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>Unless otherwise specified, white space and/or comments may appear
before, after, and/or between components in a property value or
subcomponents in a <a href="#functional-notation">functional notation</a>
that is defined using these component <a
href="#component-combinators">combinators</a> and <a
href="#component-multipliers">multipliers</a>.
<p class=note>Note: In many cases, spaces will in fact be <em>required</em>
between components 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> | <generic-family> ]#
<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:
<pre>Value: collapse | separate</pre>
<p>And here is an example of its use:
<pre>table { border-collapse: separate }</pre>
</div>
<h4 id=common-keywords><span class=secno>3.1.1. </span> CSS-wide keywords:
‘<a href="#lsquoinitialrsquo"><code class=css>initial</code></a>’ and
‘<a href="#lsquoinheritrsquo"><code class=css>inherit</code></a>’</h4>
<p>As defined <a href="#component-types">above</a>, all properties accept
the ‘<a href="#lsquoinitialrsquo"><code class=css>initial</code></a>’
and ‘<a href="#lsquoinheritrsquo"><code class=css>inherit</code></a>’
keywords, which represent value computations common to all CSS properties.
<p>The <dfn id=lsquoinheritrsquo>‘<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=lsquoinitialrsquo>‘<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>
<h4 id=custom-idents><span class=secno>3.1.2. </span> Author-defined
Identifiers: the ‘<a href="#identifier-value"><code
class=css><custom-ident></code></a>’ type</h4>
<p> Some properties accept arbitrary author-defined identifiers as a
component value. This generic data type is denoted by <dfn
id=identifier-value><var><custom-ident></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).
<p> The <a href="#common-keywords">CSS-wide keywords</a> are not valid <a
href="#identifier-value"><var><custom-ident>s</var></a>. The ‘<code
class=css>default</code>’ keyword is reserved and is also not a valid <a
href="#identifier-value"><var><custom-ident>s</var></a>.
<p> Reserved keywords are reserved in all ASCII case permutations.
<h3 id=strings><span class=secno>3.2. </span> Quoted Strings: the ‘<a
href="#string-value"><code class=css><string></code></a>’ 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):
<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.3. </span> Resource Locators: the ‘<a
href="#url-value"><code class=css><url></code></a>’ 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 ‘<code class=css>url()</code>’
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 <a href="#url-value"><i><url></i></a> appears in the computed
value of a property, it is resolved to an absolute URL, as described in
the preceding paragraph. The computed value of a URI that the UA cannot
resolve to an absolute URI is the specified value.
<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:
<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>.
<p> CSS theoretically supports infinite precision and infinite ranges for
all value types; however in reality implementations have finite capacity.
UAs should support reasonably useful ranges and precisions. <!--
The recommended minimum ranges and precision,
and the required rounding and clamping rules,
are given in <a href="#required-ranges">Appendix A</a>.
-->
<h3 id=integers><span class=secno>4.1. </span> Integers: the ‘<a
href="#integer-value"><code class=css><integer></code></a>’ 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>.
The first digit of an integer may be immediately preceded by ‘<code
class=css>-</code>’ or ‘<code class=css>+</code>’ to indicate the
integer's sign.
<h3 id=numbers><span class=secno>4.2. </span> Numbers: the ‘<a
href="#number-value"><code class=css><number></code></a>’ 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 <integer> 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>.
As with integers, the first character of a number may be immediately
preceded by ‘<code class=css>-</code>’ or ‘<code
class=css>+</code>’ to indicate the number's sign.
<h3 id=percentages><span class=secno>4.3. </span> Percentages: the ‘<a
href="#percentage-value"><code class=css><percentage></code></a>’
type</h3>
<p>A <dfn id=percentage>percentage</dfn> value is denoted by <dfn
id=percentage-value><var><percentage></var></dfn>, consists of a <a
href="#number-value"><i><number></i></a> 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 ‘<a
href="#length-value"><code class=css><length></code></a>’ 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>. However, for zero
lengths the unit identifier is optional (i.e. can be syntactically
represented as the <a href="#number-value"><var><number></var></a>
‘<code class=css>0</code>’).
<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>1% of viewport's width
<tr>
<td>‘<a href="#vh-unit"><code class=css>vh</code></a>’
<td>1% viewport's height
<tr>
<td>‘<a href="#vmin-unit"><code class=css>vmin</code></a>’
<td>1% of viewport's smaller dimension
<tr>
<td>‘<a href="#vmax-unit"><code class=css>vmax</code></a>’
<td>1% of viewport's larger dimension
</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:
<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%