-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
3264 lines (2171 loc) · 153 KB
/
Overview.html
File metadata and controls
3264 lines (2171 loc) · 153 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
</td>
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
6329
div>
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>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>CSS Values and Units Module Level 3</title>
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<style>
code, small { white-space: nowrap }
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; }
td > small { display: block; }
</style>
</head>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/">
<img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72">
</a>
</p>
<h1 class="p-name no-ref" id="title">CSS Values and Units Module Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft,
<time class="dt-updated" datetime="2014-12-19">19 December 2014</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:</dt>
<dd><a class="u-url" href="http://dev.w3.org/csswg/css-values/">http://dev.w3.org/csswg/css-values/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/css-values/">http://www.w3.org/TR/css-values/</a></dd>
<dt>Previous Versions:</dt>
<dd><a href="http://www.w3.org/TR/2013/CR-css3-values-20130730/" rel="previous">http://www.w3.org/TR/2013/CR-css3-values-20130730/</a></dd>
<dd><a href="http://www.w3.org/TR/2013/CR-css3-values-20130404/" rel="previous">http://www.w3.org/TR/2013/CR-css3-values-20130404/</a></dd>
<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></dd>
<dd><a href="http://www.w3.org/TR/2012/WD-css3-values-20120308/" rel="previous">http://www.w3.org/TR/2012/WD-css3-values-20120308/</a></dd>
<dd><a href="http://www.w3.org/TR/2011/WD-css3-values-20110906/" rel="previous">http://www.w3.org/TR/2011/WD-css3-values-20110906/</a></dd>
<dd><a href="http://www.w3.org/TR/2006/WD-css3-values-20060919" rel="previous">http://www.w3.org/TR/2006/WD-css3-values-20060919</a></dd>
<dd><a href="http://www.w3.org/TR/2005/WD-css3-values-20050726" rel="previous">http://www.w3.org/TR/2005/WD-css3-values-20050726</a></dd>
<dd><a href="http://www.w3.org/TR/2001/WD-css3-values-20010713/" rel="previous">http://www.w3.org/TR/2001/WD-css3-values-20010713/</a></dd>
<dt>Feedback:</dt>
<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-values%5D%20feedback">www-style@w3.org</a> with subject line “<kbd>[css-values] <var>… message topic …</var></kbd>” (<a href="http://lists.w3.org/Archives/Public/www-style/" rel="discussion">archives</a>)</span></dd>
<dt class="editor">Editors:</dt>
<dd class="editor">
<div class="p-author h-card vcard"><a class="p-name fn u-url url" href="http://xanthir.com/contact/">Tab Atkins</a> (<span class="p-org org">Google</span>)</div>
</dd>
<dd class="editor">
<div class="p-author h-card vcard"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">fantasai</a></div>
</dd>
<dt>Former Editors:</dt>
<dd>
<div class="p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:howcome@opera.com">Håkon Wium Lie</a> (<span class="p-org org">Opera Software</span>)</div>
</dd>
<dt>Issue Tracking:</dt>
<dd><span><a href="http://www.w3.org/Style/CSS/Tracker/products/33" rel="issues">http://www.w3.org/Style/CSS/Tracker/products/33</a></span></dd>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2014 <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>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<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.</p>
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="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 doc
8096
ument other than as work in progress.
</p>
<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=%5Bcss-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 “css-values” in the subject,
preferably like this:
“[css-values] <em>…summary of comment…</em>”
</p>
<p>
This document was produced by the <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a>
(part of the <a href="http://www.w3.org/Style/">Style Activity</a>).
</p>
<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>
<p>
This document is governed by the <a href="http://www.w3.org/2014/Process-20140801/">1 August 2014 W3C Process Document</a>.
</p>
</div>
<div data-fill-with="at-risk">
<p>The following features are at-risk, and may be dropped during the CR period:
</p>
<ul>
<li><a class="css" data-link-type="maybe" href="#funcdef-calc">calc()</a>, <a class="css" data-link-type="maybe" href="#funcdef-toggle">toggle()</a>, <a class="css" data-link-type="maybe" href="#funcdef-attr">attr()</a></li>
</ul>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="content">Table of Contents</span></h2>
<div data-fill-with="table-of-contents" role="navigation">
<ul class="toc" role="directory">
<li><a href="#intro"><span class="secno">1</span> <span class="content">
Introduction</span></a>
<ul class="toc">
<li><a href="#placement"><span class="secno">1.1</span> <span class="content">
Module Interactions</span></a></li>
</ul>
</li>
<li><a href="#value-defs"><span class="secno">2</span> <span class="content">
Value Definition Syntax</span></a>
<ul class="toc">
<li><a href="#component-types"><span class="secno">2.1</span> <span class="content">
Component value types</span></a></li>
<li><a href="#component-combinators"><span class="secno">2.2</span> <span class="content">
Component value combinators</span></a></li>
<li><a href="#component-multipliers"><span class="secno">2.3</span> <span class="content">
Component value multipliers</span></a></li>
<li><a href="#combinator-multiplier-patterns"><span class="secno">2.4</span> <span class="content">
Combinator and Multiplier Patterns</span></a></li>
<li><a href="#component-whitespace"><span class="secno">2.5</span> <span class="content">
Component values and white space</span></a></li>
<li><a href="#value-examples"><span class="secno">2.6</span> <span class="content">
Property value examples</span></a></li>
</ul>
</li>
<li><a href="#textual-values"><span class="secno">3</span> <span class="content">
Textual Data Types</span></a>
<ul class="toc">
<li><a href="#keywords"><span class="secno">3.1</span> <span class="content">
Pre-defined Keywords</span></a>
<ul class="toc">
<li><a href="#common-keywords"><span class="secno">3.1.1</span> <span class="content">
CSS-wide keywords: <span class="css" data-link-type="maybe" title="initial">initial</span> and <span class="css" data-link-type="maybe" title="inherit">inherit</span></span></a></li>
</ul>
</li>
<li><a href="#custom-idents"><span class="secno">3.2</span> <span class="content">
Author-defined Identifiers: the <span class="production" data-link-type="type" title="<custom-ident>"><custom-ident></span> type</span></a></li>
<li><a href="#strings"><span class="secno">3.3</span> <span class="content">
Quoted Strings: the <span class="production" data-link-type="type" title="<string>"><string></span> type</span></a></li>
<li><a href="#urls"><span class="secno">3.4</span> <span class="content">
Resource Locators: the <span class="production" data-link-type="type" title="<url>"><url></span> type</span></a>
<ul class="toc">
<li><a href="#relative-urls"><span class="secno">3.4.1</span> <span class="content">
Relative URLs</span></a></li>
<li><a href="#url-modifiers"><span class="secno">3.4.2</span> <span class="content">
URL Modifiers</span></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#numeric-types"><span class="secno">4</span> <span class="content">
Numeric Data Types</span></a>
<ul class="toc">
<li><a href="#integers"><span class="secno">4.1</span> <span class="content">
Integers: the <span class="production" data-link-type="type" title="<integer>"><integer></span> type</span></a></li>
<li><a href="#numbers"><span class="secno">4.2</span> <span class="content">
Real Numbers: the <span class="production" data-link-type="type" title="<number>"><number></span> type</span></a></li>
<li><a href="#percentages"><span class="secno">4.3</span> <span class="content">
Percentages: the <span class="production" data-link-type="type" title="<percentage>"><percentage></span> type</span></a></li>
<li><a href="#dimensions"><span class="secno">4.
2801
4</span> <span class="content">
Numbers with Units: <i>dimensions</i></span></a></li>
</ul>
</li>
<li><a href="#lengths"><span class="secno">5</span> <span class="content">
Distance Units: the <span class="production" data-link-type="type" title="<length>"><length></span> type</span></a>
<ul class="toc">
<li><a href="#relative-lengths"><span class="secno">5.1</span> <span class="content">
Relative lengths</span></a>
<ul class="toc">
<li><a href="#font-relative-lengths"><span class="secno">5.1.1</span> <span class="content">
Font-relative lengths: the <span class="css">em</span>, <span class="css">ex</span>, <span class="css">ch</span>, <span class="css">rem</span> units</span></a></li>
<li><a href="#viewport-relative-lengths"><span class="secno">5.1.2</span> <span class="content">
Viewport-percentage lengths: the <span class="css">vw</span>, <span class="css">vh</span>, <span class="css">vmin</span>, <span class="css">vmax</span> units</span></a></li>
</ul>
</li>
<li><a href="#absolute-lengths"><span class="secno">5.2</span> <span class="content">
Absolute lengths: the <span class="css">cm</span>, <span class="css">mm</span>, <span class="css">q</span>, <span class="css" data-link-type="maybe" title="in">in</span>, <span class="css">pt</span>, <span class="css">pc</span>, <span class="css">px</span> units</span></a></li>
</ul>
</li>
<li><a href="#other-units"><span class="secno">6</span> <span class="content">
Other Quantities</span></a>
<ul class="toc">
<li><a href="#angles"><span class="secno">6.1</span> <span class="content">
Angle Units: the <span class="production" data-link-type="type" title="<angle>"><angle></span> type and <span class="css">deg</span>, <span class="css">grad</span>, <span class="css">rad</span>, <span class="css">turn</span> units</span></a></li>
<li><a href="#time"><span class="secno">6.2</span> <span class="content">
Duration Units: the <span class="production" data-link-type="type" title="<time>"><time></span> type and <span class="css">s</span>, <span class="css">ms</span> units</span></a></li>
<li><a href="#frequency"><span class="secno">6.3</span> <span class="content">
Frequency Units: the <span class="production" data-link-type="type" title="<frequency>"><frequency></span> type and <span class="css">Hz</span>,
E3BF
<span class="css">kHz</span> units</span></a></li>
<li><a href="#resolution"><span class="secno">6.4</span> <span class="content">
Resolution Units: the <span class="production" data-link-type="type" title="<resolution>"><resolution></span> type and <span class="css">dpi</span>, <span class="css">dpcm</span>, <span class="css">dppx</span> units</span></a></li>
</ul>
</li>
<li><a href="#defined-elsewhere"><span class="secno">7</span> <span class="content">
Data Types Defined Elsewhere</span></a>
<ul class="toc">
<li><a href="#colors"><span class="secno">7.1</span> <span class="content">
Colors: the <span class="production" data-link-type="type" title="<color>"><color></span> type</span></a></li>
<li><a href="#images"><span class="secno">7.2</span> <span class="content">
Images: the <span class="production" data-link-type="type" title="<image>"><image></span> type</span></a></li>
<li><a href="#position"><span class="secno">7.3</span> <span class="content">
2D Positioning: the <span class="production" data-link-type="type" title="<position>"><position></span> type</span></a></li>
</ul>
</li>
<li><a href="#functional-notations"><span class="secno">8</span> <span class="content">
Functional Notations</span></a>
<ul class="toc">
<li><a href="#calc-notation"><span class="secno">8.1</span> <span class="content">
Mathematical Expressions: <span class="css" data-link-type="maybe" title="calc()">calc()</span></span></a>
<ul class="toc">
<li><a href="#calc-syntax"><span class="secno">8.1.1</span> <span class="content">
Syntax</span></a></li>
<li><a href="#calc-type-checking"><span class="secno">8.1.2</span> <span class="content">
Type Checking</span></a></li>
<li><a href="#calc-computed-value"><span class="secno">8.1.3</span> <span class="content">
Computed Value</span></a></li>
<li><a href="#calc-range"><span class="secno">8.1.4</span> <span class="content">
Range Checking</span></a></li>
</ul>
</li>
<li><a href="#toggle-notation"><span class="secno">8.2</span> <span class="content">
Toggling Between Values: <span class="css" data-link-type="maybe" title="toggle()">toggle()</span></span></a></li>
<li><a href="#attr-notation"><span class="secno">8.3</span> <span class="content">
Attribute References: <span class="css" data-link-type="maybe" title="attr()">attr()</span></span></a></li>
</ul>
</li>
<li><a href="#iana"><span class="secno">9</span> <span class="content">
Appendix A: IANA Considerations</span></a>
<ul class="toc">
<li><a href="#about-invalid"><span class="secno">9.1</span> <span class="content">
Registration for the <code>about:invalid</code> URL scheme</span></a></li>
</ul>
</li>
<li><a href="#acknowledgments"><span class="secno"></span> <span class="content">
Acknowledgments</span></a></li>
<li><a href="#changes"><span class="secno"></span> <span class="content">
Changes</span></a></li>
<li><a href="#conformance"><span class="secno"></span> <span class="content">
Conformance</span></a>
<ul class="toc">
<li><a href="#conventions"><span class="secno"></span> <span class="content">
Document conventions</span></a></li>
<li><a href="#conformance-classes"><span class="secno"></span> <span class="content">
Conformance classes</span></a></li>
<li><a href="#partial"><span class="secno"></span> <span class="content">
Partial implementations</span></a></li>
<li><a href="#experimental"><span class="secno"></span> <span class="content">
Experimental implementations</span></a></li>
<li><a href="#testing"><span class="secno"></span> <span class="content">
Non-experimental implementations</span></a></li>
</ul>
</li>
<li><a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ul class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a></li>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a></li>
</ul>
</li>
<li><a href="#index"><span class="secno"></span> <span class="content">Index</span></a></li>
</ul>
</div>
<main>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">
Introduction</span><a class="self-link" href="#intro"></a></h2>
<p>The value definition field of each CSS property can contain keywords,
data types (which appear between <span class="css"><</span> and <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/selectors-4/#selectordef-child">></a>), and information on how
they can be combined.
Generic data types (<a class="production css" data-link-type="type" href="#length-value"><length></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., <a class="production css" data-link-type="type"><spacing-limit></a>)
are described in the corresponding modules.</p>
<h3 class="heading settled" data-level="1.1" id="placement"><span class="secno">1.1. </span><span class="content">
Module Interactions</span><a class="self-link" href="#placement"></a></h3>
<p>This module replaces and extends the data type definitions in <a data-biblio-type="normative" data-link-type="biblio" href="#biblio-css21" title="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>.</p>
<h2 class="heading settled" data-level="2" id="value-defs"><span class="secno">2. </span><span class="content">
Value Definition Syntax</span><a class="self-link" href="#value-defs"></a></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.</p>
<h3 class="heading settled" data-level="2.1" id="component-types"><span class="secno">2.1. </span><span class="content">
Component value types</span><a class="self-link" href="#component-types"></a></h3>
<p>Component value types are designated in several ways:</p>
<ol>
<li>
<a href="#keywords">keyword</a> values (such as <span class="css">auto</span>, <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-counter-styles-3/#disc">disc</a>, etc.),
which appear literally, without quotes (e.g. <code>auto</code>)
</li>
<li>
basic data types, which appear between <span class="css"><</span> and <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/selectors-4/#selectordef-child">></a>
(e.g., <a class="production css" data-link-type="type" href="#length-value"><length></a>, <a class="production css" data-link-type="type" href="#percentage-value"><percentage></a>, etc.).
</li>
<li>
types that have the same range of values as a property bearing the same name
(e.g., <a class="production" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#border-width" title="border-width"><‘border-width’></a>, <a class="production" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#background-attachment" title="background-attachment"><‘background-attachment’></a>, 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 class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-inherit">inherit</a>.
</li>
<li>
non-terminals that do not share the same name as a property.
In this case, the non-terminal name appears between <span class="css"><</span> and <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/selectors-4/#selectordef-child">></a>,
as in <a class="production css" data-link-type="type"><spacing-limit></a>.
Notice the distinction between <a class="production css" data-link-type="type" href="http://dev.w3.org/csswg/css2/box.html#value-def-border-width"><border-width></a> and <a class="production" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#border-width" title="border-width"><‘border-width’></a>:
the latter is defined as the value of the <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#border-width">border-width</a> property,
the former requires an explicit expansion elsewhere.
The definition of a non-terminal is typically located near its first appearance in the specification.
</li>
</ol>
<p>Some property value definitions also include the slash (/),
the comma (,),
and/or parentheses as literals.
These represent their corresponding tokens.
Other non-keyword literal characters that may appear in a component value,
such as “+”,
must be written enclosed in single quotes.</p>
<p><dfn data-dfn-type="grammar" data-export="" id="comb-comma" title=",">Commas<a class="self-link" href="#comb-comma"></a></dfn> specified in the grammar are <strong>implicitly omittable</strong> in some circumstances,
when used to separate optional terms in the grammar.
Within a top-level list in a property or other CSS value,
or a function’s argument list,
a comma specified in the grammar must be omitted if:</p>
<ul>
<li>
all items preceding the comma have been omitted
</li>
<li>
all items following the comma have been omitted
</li>
<li>
multiple commas would be adjacent (ignoring whitespace/comments),
due to the items between the commas being omitted.
</li>
</ul>
<div class="example">
For example, if a function can accept three arguments in order,
but all of them are optional,
the grammar can be written like:
<pre class="prod">example( first<a data-link-for="" data-link-type="grammar" href="#mult-opt">?</a> <a data-link-for="" data-link-type="grammar" href="#comb-comma">,</a> second<a data-link-for="" data-link-type="grammar" href="#mult-opt">?</a> <a data-link-for="" data-link-type="grammar" href="#comb-comma">,</a> third<a data-link-for="" data-link-type="grammar" href="#mult-opt">?</a> )
</pre>
<p>Given this grammar,
writing <span class="css">example(first, second, third)</span> is valid,
as is <span class="css">example(first, second)</span> or <span class="css">example(first, third)</span> or <span class="css">example(second)</span>.
However, <span class="css">example(first, , third)</span> is invalid, as one of those commas are no longer separating two options;
similarly, <span class="css">example(,second)</span> and <span class="css">example(first,)</span> are invalid.
<span class="css">example(first second)</span> is also invalid,
as commas are still required to actually separate the options.</p>
<p>If commas were not implicitly omittable,
the grammar would have to be much more complicated
to properly express the ways that the arguments can be omitted,
greatly obscuring the simplicity of the feature.</p>
</div>
<p>All CSS properties also accept the <a href="#common-keywords">CSS-wide keyword values</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 class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#border-color">border-
5333
color</a>
is <code><color>{1,4} | inherit | initial | unset</code>
(even though it is listed as <code><color>{1,4}</code>).</p>
<p class="note" role="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,
<a class="css" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#background" title="background">background: url(corner.png) no-repeat, inherit;</a> is invalid.</p>
<h3 class="heading settled" data-level="2.2" id="component-combinators"><span class="secno">2.2. </span><span class="content">
Component value combinators</span><a class="self-link" href="#component-combinators"></a></h3>
<p>Component values can be arranged into property values as follows:</p>
<ul data-dfn-type="grammar" data-export="">
<li>Juxtaposing components means that
all of them must occur, in the given order.
</li>
<li>A double ampersand (<dfn data-dfn-type="grammar" data-export="" id="comb-all">&&<a class="self-link" href="#comb-all"></a></dfn>) separates two or more components,
all of which must occur, in any order.
</li>
<li>A double bar (<dfn data-dfn-type="grammar" data-export="" id="comb-any">||<a class="self-link" href="#comb-any"></a></dfn>) separates two or more options:
one or more of them must occur, in any order.
</li>
<li>A bar (<dfn data-dfn-type="grammar" data-export="" id="comb-one">|<a class="self-link" href="#comb-one"></a></dfn>) separates two or more alternatives:
exactly one of them must occur.
</li>
<li>Brackets ([ ]) are for grouping.
</li>
</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:</p>
<pre> a b | c || d && e f
[ a b ] | [ c || [ d && [ e f ]]]
</pre>
<p>For re-orderable combinators (||, &&),
ordering of the grammar does not matter:
components in the same grouping may be interleaved in any order.
Thus, the following lines are equivalent:</p>
<pre>a || b || c
b || a || c
</pre>
<h3 class="heading settled" data-level="2.3" id="component-multipliers"><span class="secno">2.3. </span><span class="content">
Component value multipliers</span><a class="self-link" href="#component-multipliers"></a></h3>
<p>Every type, keyword, or bracketed group may be followed by one of
the following modifiers:</p>
<ul data-dfn-type="grammar" data-export="">
<li>An asterisk (<dfn data-dfn-type="grammar" data-export="" id="mult-zero-plus">*<a class="self-link" href="#mult-zero-plus"></a></dfn>) indicates that the preceding type, word, or
group occurs zero or more times.
</li>
<li>A plus (<dfn data-dfn-type="grammar" data-export="" id="mult-one-plus">+<a class="self-link" href="#mult-one-plus"></a></dfn>) indicates that the preceding type, word, or group
occurs one or more times.
</li>
<li>A question mark (<dfn data-dfn-type="grammar" data-export="" id="mult-opt">?<a class="self-link" href="#mult-opt"></a></dfn>) indicates that the preceding type, word, or
group is optional (occurs zero or one times).
</li>
<li>A single number in curly braces (<dfn data-dfn-type="grammar" data-export="" id="mult-num">{<var>A</var>}<a class="self-link" href="#mult-num"></a></dfn>)
indicates that the preceding type, word, or group occurs <var>A</var> times.
</li>
<li>A comma-separated pair of numbers in curly braces (<dfn data-dfn-type="grammar" data-export="" id="mult-num-range">{<var>A</var>,<var>B</var>}<a class="self-link" href="#mult-num-range"></a></dfn>)
indicates that the preceding type, word, or group occurs at least
<var>A</var> and at most <var>B</var> times.
The <var>B</var> may be omitted ({<var>A</var>,})
to indicate that there must be at least <var>A</var> repetitions,
with no upper bound on the number of repetitions.
</li>
<li>A hash mark (<dfn data-dfn-type="grammar" data-export="" id="mult-comma">#<a class="self-link" href="#mult-comma"></a></dfn>) indicates that the preceding type, word, or
group occurs one or more times, separated by comma tokens
(which may optionally be surrounded by white space and/or comments).
It may optionally be followed by the curly brace forms, above,
to indicate precisely how many times the repetition occurs,
like <span class="css"><length>#{1,4}</span>.
</li>
<li>An exclamation point (<dfn data-dfn-type="grammar" data-export="" id="mult-req">!<a class="self-link" href="#mult-req"></a></dfn>) after a group indicates that the group is required
and must produce at least one value;
even if the grammar of the items within the group would otherwise allow the entire contents to be omitted,
at least one component value must not be omitted.
</li>
</ul>
<p>For repeated component values (indicated by <span class="css">*</span>, <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/selectors-4/#selectordef-adjacent">+</a>, or <span class="css">#</span>),
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.</p>
<h3 class="heading settled" data-level="2.4" id="combinator-multiplier-patterns"><span class="secno">2.4. </span><span class="content">
Combinator and Multiplier Patterns</span><a class="self-link" href="#combinator-multiplier-patterns"></a></h3>
<p>There are a small set of common ways to combine multiple independent <a data-link-type="dfn" href="http://dev.w3.org/csswg/css-syntax-3/#component-value">component values</a> in particular numbers and orders.
In particular, it’s common to want to express that,
from a set of component value,
the author must select zero or more, one or more, or all of them,
and in either the order specified in the grammar or in any order.</p>
<p>All of these can be easily expressed using simple patterns of <a href="#component-combinators">combinators</a> and <a href="#component-multipliers">multipliers</a>:</p>
<table class="data">
<thead>
<tr>
<th>
</th>
<th>in order
</th>
<th>any order
</th>
</tr>
</thead>
<tbody>
<tr>
<th>zero or more
</th>
<td>
<pre>A? B? C?</pre>
</td>
<td>
<pre> A? || B? || C?</pre>
</td>
</tr>
<tr>
<th>one or more
</th>
<td>
<pre> [ A? B? C? ]!</pre>
</td>
<td>
<pre>A || B || C</pre>
</td>
</tr>
<tr>
<th>all
</th>
<td>
<pre>A B C </pre>
</td>
<td>
<pre>A && B && C</pre>
</td>
</tr>
</tbody>
</table>
<p>Note that all of the "any order" possibilities are expressed using combinators,
while the "in order" possibilities are all variants on juxtaposition.</p>
<h3 class="heading settled" data-level="2.5" id="component-whitespace"><span class="secno">2.5. </span><span class="content">
Component values and white space</span><a class="self-link" href="#component-whitespace"></a></h3>
<p>Unless otherwise specified,
white space and/or comments may appear before, after, and/or between
components combined using the above
<a href="#component-combinators">combinators</a> and
<a href="#component-multipliers">multipliers</a>.</p>
<p class="note" role="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 <span class="css">1em2em</span> would be parsed as a single <a class="production css" data-link-type="type" href="http://dev.w3.org/csswg/css-syntax-3/#typedef-dimension-token"><dimension-token></a>
with the number <span class="css">1</span> and the identifier <span class="css">em2em</span>,
which is an invalid unit.
In this case, a space would be required before the <span class="css">2</span>
to get this parsed as the two lengths <span class="css">1em</span>and <span class="css">2em</span>.</p>
<h3 class="heading settled" data-level="2.6" id="value-examples"><span class="secno">2.6. </span><span class="content">
Property value examples</span><a class="self-link" href="#value-examples"></a></h3>
<p>Below are some examples of properties with their corresponding value
definition fields</p>
<div class="example">
<table class="data" id="propvalues">
<thead>
<tr>
<th>Property
</th>
<th>Value definition field
</th>
<th>Example value
</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-break-3/#orphans">orphans</a>
</td>
<td><integer>
</td>
<td><span class="css">3</span>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-text-3/#propdef-text-align">text-align</a>
</td>
<td>left | right | center | justify
</td>
<td><a class="css" data-link-for="text-align" data-link-type="maybe" href="http://dev.w3.org/csswg/css-text-3/#valdef-text-align-center">center</a>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/box.html#propdef-padding-top">padding-top</a>
</td>
<td><length> | <percentage>
</td>
<td><span class="css">5%</span>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-ui-3/#propdef-outline-color">outline-color</a>
</td>
<td><color> | invert
</td>
<td><span class="css">#fefefe</span>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-decoration">text-decoration</a>
</td>
<td>none | underline || overline || line-through || blink
</td>
<td><span class="css">overline underline</span>
</td>
</tr>
<tr>
<td><a class="css" data-link-type="property" href="http://dev.w3.org/csswg/css-fonts-3/#propdef-font-family">font-family</a>
</td>
<td>[ <family-name> | <generic-family> ]#
</td>
<td><span class="css">"Gill Sans", Futura, sans-serif</span>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-backgrounds-3/#border-width">border-width</a>
</td>
<td>[ <length> | thick | medium | thin ]{1,4}
</td>
<td><span class="css">2px medium 4px</span>
</td>
</tr>
<tr>
<td><a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-shadow">text-shadow</a>
</td>
<td>[ inset? && [ <length>{2,4} && <color>? ] ]# | none
</td>
<td><span class="css">3px 3px rgba(50%, 50%, 50%, 50%), lemonchiffon 0 0 4px inset</span>
</tr>
</tbody>
</table>
</div>
<h2 class="heading settled" data-level="3" id="textual-values"><span class="secno">3. </span><span class="content">
Textual Data Types</span><a class="self-link" href="#textual-values"></a></h2>
<p>An <dfn data-dfn-type="dfn" data-noexport="" id="identifier">identifier<a class="self-link" href="#identifier"></a></dfn> is a sequence of characters conforming to the <a class="production css" data-link-type="type" href="http://dev.w3.org/csswg/css-syntax-3/#typedef-ident-token"><ident-token></a> grammar. <a data-biblio-type="normative" data-link-type="biblio" href="#biblio-css3syn" title="CSS3SYN">[CSS3SYN]</a>
Identifiers cannot be quoted;
otherwise they would be interpreted as a string.</p>
<h3 class="heading settled" data-level="3.1" id="keywords"><span class="secno">3.1. </span><span class="content">
Pre-defined Keywords</span><a class="self-link" href="#keywords"></a></h3>
<p>In the value definition fields,
keywords with a pre-defined meaning appear literally.
Keywords are CSS <i>identifiers</i>
and are interpreted <a data-link-type="dfn" href="http://dev.w3.org/csswg/css-syntax-3/#ascii-case-insensitive" title="ASCII case-insensitive">ASCII case-insensitively</a>
(i.e., [a-z] and [A-Z] are equivalent).</p>
<div class="example">
For example, here is the value definition for the <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css2/tables.html#propdef-border-collapse">border-collapse</a>
property:
<pre>Value: collapse | separate</pre>
<p>And here is an example of its use:</p>
<pre>table { border-collapse: separate }</pre>
</div>
<h4 class="heading settled" data-level="3.1.1" id="common-keywords"><span class="secno">3.1.1. </span><span class="content">
CSS-wide keywords: <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-initial">initial</a> and <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-inherit">inherit</a></span><a class="self-link" href="#common-keywords"></a></h4>
<p>As defined <a href="#component-types">above</a>,
all properties accept the <dfn data-dfn-type="dfn" data-noexport="" id="css-wide-keywords">CSS-wide keywords<a class="self-link" href="#css-wide-keywords"></a></dfn>,
which represent value computations common to all CSS properties.</p>
<p>The <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-initial">initial</a> keyword represents the value specified as the property’s initial value.
The <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-inherit">inherit</a> keyword represents the computed value of the property on the element’s parent.
The <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-unset">unset</a> keyword acts as either <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-inherit">inherit</a> or <a class="css" data-link-type="maybe" href="http://dev.w3.org/csswg/css-cascade-3/#valuedef-initial">initial</a>,
depending on whether the property is inherited or not.
All of these keywords are normatively defined in the Cascade module. <a data-biblio-type="normative" data-link-type="biblio" href="#biblio-css3cascade" title="CSS3CASCADE">[CSS3CASCADE]</a></p>
<p>Other CSS specifications can define additional CSS-wide keywords.</p>
<h3 class="heading settled" data-level="3.2" id="custom-idents"><span class="secno">3.2. </span><span class="content">
Author-defined Identifiers: the <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a> type</span><a class="self-link" href="#custom-idents"></a></h3>
<p>Some properties accept arbitrary author-defined identifiers as a component value.
This generic data type is denoted by <dfn class="css" data-dfn-type="type" data-export="" id="identifier-value"><custom-ident><a class="self-link" href="#identifier-value"></a></dfn>,
and represents any valid CSS <i>identifier</i>
that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
Such identifiers are fully case-sensitive,
even in the ASCII range
(e.g. <span class="css">example</span> and <span class="css">EXAMPLE</span> are two different, unrelated user-defined identifiers).</p>
<p>The <a data-link-type="dfn" href="#css-wide-keywords">CSS-wide keywords</a> are not valid <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a>s.
The <span class="css">default</span> keyword is reserved
and is also not a valid <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a>.
Specifications using <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a> must specify clearly
what other keywords are excluded from <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a>, if any—<wbr>for example by saying that any pre-defined keywords in that property’s value definition are excluded.
Excluded keywords are excluded in all <a data-link-type="dfn" href="http://dev.w3.org/csswg/css-syntax-3/#ascii-case-insensitive" title="ASCII case-insensitive">ASCII case permutations</a>.</p>
<p>When parsing positionally-ambiguous keywords in a property value,
a <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a> production can only claim the keyword if no other unfulfilled production can claim it.</p>
<div class="example">
For example, the shorthand declaration <a class="css" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-animations-1/#propdef-animation" title="animation">animation: ease-in ease-out&
37F7
lt;/a>
is equivalent to the longhand declarations
<a class="css" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-animations-1/#propdef-animation-timing-function" title="animation-timing-function">animation-timing-function: ease-in; animation-name: ease-out;</a>.
<span class="css">ease-in</span> is claimed by the <a class="production css" data-link-type="type" href="http://dev.w3.org/csswg/css-animations-1/#typedef-single-timing-function"><single-timing-function></a> production belonging to <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-animations-1/#propdef-animation-timing-function">animation-timing-function</a>,
leaving <span class="css">ease-out</span> to be claimed by the <a class="production css" data-link-type="type" href="#identifier-value"><custom-ident></a> production belonging to <a class="property" data-link-type="propdesc" href="http://dev.w3.org/csswg/css-animations-1/#propdef-animation-name">animation-name</a>.
</div>
<h3 class="heading settled" data-level="3.3" id="strings"><span class="secno">3.3. </span><span class="content">
Quoted Strings: the <a class="production css" data-link-type="type" href="#string-value"><string></a> type</span><a class="self-link" href="#strings"></a></h3>
<p><dfn data-dfn-type="dfn" data-export="" id="string" title="string">Strings<a class="self-link" href="#string"></a></dfn> are denoted by <dfn class="css" data-dfn-type="type" data-export="" id="string-value"><string><a class="self-link" href="#string-value"></a></dfn>
and consist of a sequence of characters delimited by double quotes or
single quotes. They correspond to the <a class="production css" data-link-type="type" href="http://dev.w3.org/csswg/css-syntax-3/#typedef-string-token"><string-token></a> production
in the <a href="http://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> <a data-biblio-type="normative" data-link-type="biblio" href="#biblio-css3syn" title="CSS3SYN">[CSS3SYN]</a>.</p>
<div class="example">
Double quotes cannot occur inside double quotes, unless
<a href="http://www.w3.org/TR/CSS21/syndata.html#escaped-characters">escaped</a>
(as <code>"\""</code> or as <code>"\22"</code>).
Analogously for single quotes (<code>'\''</code> or <code>'\27'</code>).