-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
2067 lines (1695 loc) · 143 KB
/
Overview.html
File metadata and controls
2067 lines (1695 loc) · 143 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><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 heading" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20140622>22 June 2014</span></span></span></h2>
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-values/>http://dev.w3.org/csswg/css-values/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-values/>http://www.w3.org/TR/css-values/</a><dt>Previous Versions:<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><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><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><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><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><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><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><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>
<dt>Feedback:</dt>
<dd><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>)<dt>Editors:
<dd 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>)<dd class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://fantasai.inkedblade.net/contact>fantasai</a><dt>Former Editors:
<dd 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>)<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></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 heading" id=abstract><span class=content>Abstract</span></h2>
<p 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.</p>
<h2 class="no-num no-toc no-ref heading settled heading" 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 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=%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>
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>
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>.</div>
<div data-fill-with=at-risk><p>The following features are at-risk, and may be dropped during the CR period:
<ul><li><a class=css data-link-type=maybe href=#funcdef-calc title=calc()>calc()</a>, <a class=css data-link-type=maybe href=#funcdef-toggle title=toggle()>toggle()</a>, <a class=css data-link-type=maybe href=#funcdef-attr title=attr()>attr()</a></ul></div>
<h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc>
<li><a href=#intro><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=#combinator-multiplier-patterns><span class=secno>2.4</span> Combinator and Multiplier Patterns</a>
<li><a href=#component-whitespace><span class=secno>2.5</span> Component values and white space</a>
<li><a href=#value-examples><span class=secno>2.6</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: <span class=css data-link-type=maybe title=initial>initial</span> and <span class=css data-link-type=maybe title=inherit>inherit</span></a></ul>
<li><a href=#custom-idents><span class=secno>3.2</span> Author-defined Identifiers: the <span class=production data-link-type=type title="<custom-ident>"><custom-ident></span> type</a>
<li><a href=#strings><span class=secno>3.3</span> Quoted Strings: the <span class=production data-link-type=type title="<string>"><string></span> type</a>
<li><a href=#urls><span class=secno>3.4</span> Resource Locators: the <span class=production data-link-type=type title="<url>"><url></span> 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 <span class=production data-link-type=type title="<integer>"><integer></span> type</a>
<li><a href=#numbers><span class=secno>4.2</span> Real Numbers: the <span class=production data-link-type=type title="<number>"><number></span> type</a>
<li><a href=#percentages><span class=secno>4.3</span> Percentages: the <span class=production data-link-type=type title="<percentage>"><percentage></span> type</a>
<li><a href=#dimensions><span class=secno>4.4</span> Numbers with Units: <span data-link-type=dfn title=dimensions>dimensions</span></a></ul>
<li><a href=#lengths><span class=secno>5</span> Distance Units: the <span class=production data-link-type=type title="<length>"><length></span> 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 <span class=css data-link-type=maybe title=em>em</span>, <span class=css data-link-type=maybe title=ex>ex</span>, <span class=css data-link-type=maybe title=ch>ch</span>, <span class=css data-link-type=maybe title=rem>rem</span> units</a>
<li><a href=#viewport-relative-lengths><span class=secno>5.1.2</span> Viewport-percentage lengths: the <span class=css data-link-type=maybe title=vw>vw</span>, <span class=css data-link-type=maybe title=vh>vh</span>, <span class=css data-link-type=maybe title=vmin>vmin</span>, <span class=css data-link-type=maybe title=vmax>vmax</span> units</a></ul>
<li><a href=#absolute-lengths><span class=secno>5.2</span> Absolute lengths: the <span class=css data-link-type=maybe title=cm>cm</span>, <span class=css data-link-type=maybe title=mm>mm</span>, <span class=css data-link-type=maybe title=q>q</span>, <span class=css data-link-type=maybe title=in>in</span>, <span class=css data-link-type=maybe title=pt>pt</span>, <span class=css data-link-type=maybe title=pc>pc</span>, <span class=css data-link-type=maybe title=px>px</span> units</a></ul>
<li><a href=#other-units><span class=secno>6</span> Other Quantities</a>
<ul class=toc>
<li><a href=#angles><span class=secno>6.1</span> Angle Units: the <span class=production data-link-type=type title="<angle>"><angle></span> type and <span class=css data-link-type=maybe title=deg>deg</span>, <span class=css data-link-type=maybe title=grad>grad</span>, <span class=css data-link-type=maybe title=rad>rad</span>, <span class=css data-link-type=maybe title=turn>turn</span> units</a>
<li><a href=#time><span class=secno>6.2</span> Duration Units: the <span class=production data-link-type=type title="<time>"><time></span> type and <span class=css data-link-type=maybe title=s>s</span>, <span class=css data-link-type=maybe title=ms>ms</span> units</a>
<li><a href=#frequency><span class=secno>6.3</span> Frequency Units: the <span class=production data-link-type=type title="<frequency>"><frequency></span> type and <span class=css data-link-type=maybe title=hz>Hz</span>, <span class=css data-link-type=maybe title=khz>kHz</span> units</a>
<li><a href=#resolution><span class=secno>6.4</span> Resolution Units: the <span class=production data-link-type=type title="<resolution>"><resolution></span> type and <span class=css data-link-type=maybe title=dpi>dpi</span>, <span class=css data-link-type=maybe title=dpcm>dpcm</span>, <span class=css data-link-type=maybe title=dppx>dppx</span> 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 <span class=production data-link-type=type title="<color>"><color></span> type</a>
<li><a href=#images><span class=secno>7.2</span> Images: the <span class=production data-link-type=type title="<image>"><image></span> type</a>
<li><a href=#position><span class=secno>7.3</span> 2D Positioning: the <span class=production data-link-type=type title="<position>"><position></span> 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: <span class=css data-link-type=maybe title=calc()>calc()</span></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: <span class=css data-link-type=maybe title=toggle()>toggle()</span></a>
<li><a href=#attr-notation><span class=secno>8.3</span> Attribute References: <span class=css data-link-type=maybe title=attr()>attr()</span></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><a href=#acknowledgments><span class=secno></span> Acknowledgments</a>
<li><a href=#changes><span class=secno></span> Changes</a>
<li><a href=#conformance><span class=secno></span> Conformance</a>
<ul class=toc>
<li><a href=#conventions><span class=secno></span> Document conventions</a>
<li><a href=#conformance-classes><span class=secno></span> Conformance classes</a>
<li><a href=#partial><span class=secno></span> Partial implementations</a>
<li><a href=#experimental><span class=secno></span> Experimental implementations</a>
<li><a href=#testing><span class=secno></span> Non-experimental implementations</a></ul>
<li><a href=#references><span class=secno></span> References</a>
<ul class=toc>
<li><a href=#normative><span class=secno></span> Normative References</a>
<li><a href=#informative><span class=secno></span> Informative References</a></ul>
<li><a href=#index><span class=secno></span> Index</a>
<li><a href=#property-index><span class=secno></span> Property index</a></ul></div>
<h2 class="heading settled heading" 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 data-link-type=maybe title=<><</span> and <span class=css data-link-type=maybe title=">">></span>), and information on how
they can be combined.
Generic data types (<a class="production css-code" data-link-type=type href=#length-value title="<length>"><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-code" data-link-type=type title="<spacing-limit>"><spacing-limit></a>)
are described in the corresponding modules.</p>
<h3 class="heading settled heading" 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=biblio-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 heading" 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 heading" 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 data-link-type=maybe title=auto>auto</span>, <span class=css data-link-type=maybe title=disc>disc</span>, etc.),
which appear literally, without quotes (e.g. <code>auto</code>)
<li>
basic data types, which appear between <span class=css data-link-type=maybe title=<><</span> and <span class=css data-link-type=maybe title=">">></span>
(e.g., <a class="production css-code" data-link-type=type href=#length-value title="<length>"><length></a>, <a class="production css-code" data-link-type=type href=#percentage-value title="<percentage>"><percentage></a>, etc.).
<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 <span class=css data-link-type=maybe title=inherit>inherit</span>.
<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 data-link-type=maybe title=<><</span> and <span class=css data-link-type=maybe title=">">></span>,
as in <a class="production css-code" data-link-type=type title="<spacing-limit>"><spacing-limit></a>.
Notice the distinction between <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css2/box.html#value-def-border-width title="<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 title=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.
</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>
all items following the comma have been omitted
<li>
multiple commas would be adjacent (ignoring whitespace/comments),
due to the items between the commas being omitted.
</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 class=prod-punc data-link-type=grammar href=#mult-opt title=?>?</a> <a class=prod-punc data-link-type=grammar href=#comb-comma title=,>,</a> second<a class=prod-punc data-link-type=grammar href=#mult-opt title=?>?</a> <a class=prod-punc data-link-type=grammar href=#comb-comma title=,>,</a> third<a class=prod-punc data-link-type=grammar href=#mult-opt title=?>?</a> )
</pre>
<p>Given this grammar,
writing <span class=css data-link-type=maybe title="example(first, second, third)">example(first, second, third)</span> is valid,
as is <span class=css data-link-type=maybe title="example(first, second)">example(first, second)</span> or <span class=css data-link-type=maybe title="example(first, third)">example(first, third)</span> or <span class=css data-link-type=maybe title=example(second)>example(second)</span>.
However, <span class=css data-link-type=maybe title="example(first, , third)">example(first, , third)</span> is invalid, as one of those commas are no longer separating two options;
similarly, <span class=css data-link-type=maybe title=example(,second)>example(,second)</span> and <span class=css data-link-type=maybe title=example(first,)>example(first,)</span> are invalid.
<span class=css data-link-type=maybe title="example(first second)">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 title=border-color>border-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>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 heading" 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>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>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>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>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:</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 heading" 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>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>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>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>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>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 data-link-type=maybe title="<length>#{1,4}"><length>#{1,4}</span>.
<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.
</ul>
<p>For repeated component values (indicated by <span class=css data-link-type=maybe title=*>*</span>, <span class=css data-link-type=maybe title=+>+</span>, or <span class=css data-link-type=maybe title=#>#</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 heading" 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 title="component values">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>in order
<th>any order
<tbody>
<tr>
<th>zero or more
<td><pre>A? B? C?</pre>
<td><pre> A? || B? || C?</pre>
<tr>
<th>one or more
<td><pre> [ A? B? C? ]!</pre>
<td><pre>A || B || C</pre>
<tr>
<th>all
<td><pre>A B C </pre>
<td><pre>A && B && C</pre>
</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 heading" 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>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 data-link-type=maybe title=1em2em>1em2em</span> would be parsed as a single <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-dimension-token title="<dimension-token>"><dimension-token></a>
with the number <span class=css data-link-type=maybe title=1>1</span> and the identifier <span class=css data-link-type=maybe title=em2em>em2em</span>,
which is an invalid unit.
In this case, a space would be required before the <span class=css data-link-type=maybe title=2>2</span>
to get this parsed as the two lengths <span class=css data-link-type=maybe title=1em>1em</span>and <span class=css data-link-type=maybe title=2em>2em</span>.</p>
<h3 class="heading settled heading" 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>Value definition field
<th>Example value
</thead>
<tbody>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-break-3/#orphans title=orphans>orphans</a>
<td><integer>
<td><span class=css data-link-type=maybe title=3>3</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-text-3/#propdef-text-align title=text-align>text-align</a>
<td>left | right | center | justify
<td><span class=css data-link-type=maybe title=center>center</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/box.html#propdef-padding-top title=padding-top>padding-top</a>
<td><length> | <percentage>
<td><span class=css data-link-type=maybe title=5%>5%</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-ui-3/#outline-color0 title=outline-color>outline-color</a>
<td><color> | invert
<td><span class=css data-link-type=maybe title=#fefefe>#fefefe</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-decoration title=text-decoration>text-decoration</a>
<td>none | underline || overline || line-through || blink
<td><span class=css data-link-type=maybe title="overline underline">overline underline</span>
<tr><td><a class=css-code data-link-type=property href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-family title=font-family>font-family</a>
<td>[ <family-name> | <generic-family> ]#
<td><span class=css data-link-type=maybe title='"gill sans", futura, sans-serif'>"Gill Sans", Futura, sans-serif</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-width title=border-width>border-width</a>
<td>[ <length> | thick | medium | thin ]{1,4}
<td><span class=css data-link-type=maybe title="2px medium 4px">2px medium 4px</span>
<tr><td><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-shadow title=text-shadow>text-shadow</a>
<td>[ inset? && [ <length>{2,4} && <color>? ] ]# | none
<td><span class=css data-link-type=maybe title="3px 3px rgba(50%, 50%, 50%, 50%), lemonchiffon 0 0 4px inset">3px 3px rgba(50%, 50%, 50%, 50%), lemonchiffon 0 0 4px inset</span>
</tbody>
</table>
</div>
<h2 class="heading settled heading" 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-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-ident-token title="<ident-token>"><ident-token></a> grammar. <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3syn title=biblio-css3syn>[CSS3SYN]</a>
Identifiers cannot be quoted;
otherwise they would be interpreted as a string.</p>
<h3 class="heading settled heading" 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 <a data-link-type=dfn href=#identifier title=identifiers>identifiers</a>
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 title=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 heading" data-level=3.1.1 id=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 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 <span class=css data-link-type=maybe title=initial>initial</span> keyword represents the value specified as the property’s initial value.
The <span class=css data-link-type=maybe title=inherit>inherit</span> keyword represents the computed value of the property on the element’s parent.
The <span class=css data-link-type=maybe title=unset>unset</span> keyword acts as either <span class=css data-link-type=maybe title=inherit>inherit</span> or <span class=css data-link-type=maybe title=initial>initial</span>,
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=biblio-css3cascade>[CSS3CASCADE]</a></p>
<p>Other CSS specifications can define additional CSS-wide keywords.</p>
<h3 class="heading settled heading" data-level=3.2 id=custom-idents><span class=secno>3.2 </span><span class=content>
Author-defined Identifiers: the <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><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-code 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 <a data-link-type=dfn href=#identifier title=identifier>identifier</a>
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 data-link-type=maybe title=example>example</span> and <span class=css data-link-type=maybe title=example>EXAMPLE</span> are two different, unrelated user-defined identifiers).</p>
<p>The <a data-link-type=dfn href=#css-wide-keywords title="css-wide keywords">CSS-wide keywords</a> are not valid <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a>s.
The <span class=css data-link-type=maybe title=default>default</span> keyword is reserved
and is also not a valid <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a>.</p>
<p>Specifications using <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a> should specify clearly
what other keywords are excluded from <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a>—for
example by saying that any pre-defined keywords in that property’s value definition are excluded.
As a general rule, an identifier that could be interpreted as a pre-defined keyword
in any position or multiplication of the <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a> component value
is excluded,
and is invalid as a <a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a> matching to that component value
even in positions where its use would be technically unambiguous.
For example, if a keyword could be misparsed when specified
as the first item of a ''<a class="production css-code" data-link-type=type href=#identifier-value title="<custom-ident>"><custom-ident></a>+'' list,
it is invalid when specified in any position in that list.</p>
<p>Excluded keywords are excluded in all ASCII case permutations.</p>
<h3 class="heading settled heading" data-level=3.3 id=strings><span class=secno>3.3 </span><span class=content>
Quoted Strings: the <a class="production css-code" data-link-type=type href=#string-value title="<string>"><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-code 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-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-string-token title="<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=biblio-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>).
<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:</p>
<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.)</p>
<h3 class="heading settled heading" data-level=3.4 id=urls><span class=secno>3.4 </span><span class=content>
Resource Locators: the <a class="production css-code" data-link-type=type href=#url-value title="<url>"><url></a> type</span><a class=self-link href=#urls></a></h3>
<p>A <dfn data-dfn-type=dfn data-noexport="" id=url>URL<a class=self-link href=#url></a></dfn> is a pointer to a resource
and is a <a data-link-spec=css-syntax data-link-type=dfn href=http://dev.w3.org/csswg/css-syntax-3/#consume-a-url-token0 title="consume a url token">specially-parsed</a> <a href=#functional-notation>functional notation</a>
denoted by <dfn class=css-code data-dfn-type=type data-export="" id=url-value><url><a class=self-link href=#url-value></a></dfn>.
It corresponds to the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-url-token title="<url-token>"><url-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=biblio-css3syn>[CSS3SYN]</a>.</p>
<div class=example>
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:</p>
<pre>body { background: url(http://www.example.com/pinkish.gif) }</pre>
</div>
<p class=note>Note: Note that in some CSS syntactic contexts (as defined by that context),
a URL can be represented as a <a class="production css-code" data-link-type=type href=#string-value title="<string>"><string></a> rather than by <a class="production css-code" data-link-type=type href=#url-value title="<url>"><url></a>.
An example of this is the <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-cascade-3/#at-ruledef-import title=@import>@import</a> rule.</p>
<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 class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-url-token title="<url-token>"><url-token></a>,
e.g. <span class=css data-link-type=maybe title=url(open\(parens)>url(open\(parens)</span>, <span class=css data-link-type=maybe title=url(close\)parens)>url(close\)parens)</span>.
Depending on the type of URL,
it might also be possible to write these characters as URI-escapes
(e.g. <span class=css data-link-type=maybe title=url(open%28parens)>url(open%28parens)</span> or <span class=css data-link-type=maybe title=url(close%29parens)>url(close%29parens)</span>)
as described in <a data-biblio-type=informative data-link-type=biblio href=#biblio-uri title=biblio-uri>[URI]</a>.
Alternatively a URL containing such characters may be represented as a quoted <a data-link-type=dfn href=#string title=string>string</a> within the <span class=css data-link-type=maybe title=url()>url()</span> notation.</p>
<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 data-biblio-type=normative data-link-type=biblio href=#biblio-uri title=biblio-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 itself,
not that of the styled source document.
Style sheets embedded within a document have
the base URL associated with their container.</p>
<p>When a <a class="production css-code" data-link-type=type href=#url-value title="<url>"><url></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.</p>
<div class=example>
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 <code><body></code>
will be tiled with whatever image is described by the resource designated by the URL:</p>
<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 <code><body></code>.</p>
</div>
<h2 class="heading settled heading" data-level=4 id=numeric-types><span class=secno>4 </span><span class=content>
Numeric Data Types</span><a class=self-link href=#numeric-types></a></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>
<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.</p>
<h3 class="heading settled heading" data-level=4.1 id=integers><span class=secno>4.1 </span><span class=content>
Integers: the <a class="production css-code" data-link-type=type href=#integer-value title="<integer>"><integer></a> type</span><a class=self-link href=#integers></a></h3>
<p>Integer values are denoted by <dfn class=css-code data-dfn-type=type data-export="" id=integer-value><integer><a class=self-link href=#integer-value></a></dfn>.
An <dfn data-dfn-type=dfn data-noexport="" id=integer>integer<a class=self-link href=#integer></a></dfn> is one or more decimal digits <span class=css data-link-type=maybe title=0>0</span> through <span class=css data-link-type=maybe title=9>9</span>
and corresponds to a subset of the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-number-token title="<number-token>"><number-token></a> production
in the CSS Syntax Module <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3syn title=biblio-css3syn>[CSS3SYN]</a>.
The first digit of an integer may be immediately preceded by <span class=css data-link-type=maybe title=->-</span> or <span class=css data-link-type=maybe title=+>+</span>
to indicate the integer’s sign.</p>
<h3 class="heading settled heading" data-level=4.2 id=numbers><span class=secno>4.2 </span><span class=content>
Real Numbers: the <a class="production css-code" data-link-type=type href=#number-value title="<number>"><number></a> type</span><a class=self-link href=#numbers></a></h3>
<p>Number values are denoted by <dfn class=css-code data-dfn-type=type data-export="" id=number-value><number><a class=self-link href=#number-value></a></dfn>.
A <dfn data-dfn-type=dfn data-noexport="" id=number>number<a class=self-link href=#number></a></dfn> is either an <a class="production css-code" data-link-type=type href=#integer-value title="<integer>"><integer></a>
or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits
and optionally an exponent composed of "e" or "E" and an integer.
It corresponds to the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-number-token title="<number-token>"><number-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=biblio-css3syn>[CSS3SYN]</a>.
As with integers, the first character of a number may be immediately preceded by <span class=css data-link-type=maybe title=->-</span> or <span class=css data-link-type=maybe title=+>+</span>
to indicate the number’s sign.</p>
<h3 class="heading settled heading" data-level=4.3 id=percentages><span class=secno>4.3 </span><span class=content>
Percentages: the <a class="production css-code" data-link-type=type href=#percentage-value title="<percentage>"><percentage></a> type</span><a class=self-link href=#percentages></a></h3>
<p>A <dfn data-dfn-type=dfn data-noexport="" id=percentage>percentage<a class=self-link href=#percentage></a></dfn> value is denoted by
<dfn class=css-code data-dfn-type=type data-export="" id=percentage-value><percentage><a class=self-link href=#percentage-value></a></dfn>,
and consists of a <a class="production css-code" data-link-type=type href=#number-value title="<number>"><number></a>
immediately followed by a percent sign <span class=css data-link-type=maybe title=%>%</span>.
It corresponds to the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-percentage-token title="<percentage-token>"><percentage-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=biblio-css3syn>[CSS3SYN]</a>.</p>
<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 data-link-type=dfn title="containing block">containing block</i>).</p>
<h3 class="heading settled heading" data-level=4.4 id=dimensions><span class=secno>4.4 </span><span class=content>
Numbers with Units: <a data-link-type=dfn href=#dimension title=dimensions>dimensions</a></span><a class=self-link href=#dimensions></a></h3>
<p>A <dfn data-dfn-type=dfn data-noexport="" id=dimension>dimension<a class=self-link href=#dimension></a></dfn> is a <a class="production css-code" data-link-type=type href=#number-value title="<number>"><number></a>
immediately followed by a unit identifier.
It corresponds to the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-dimension-token title="<dimension-token>"><dimension-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=biblio-css3syn>[CSS3SYN]</a>.
Like keywords, unit identifiers are <a data-link-type=dfn href=http://dev.w3.org/csswg/css-syntax-3/#ascii-case-insensitive title="ascii case-insensitive">ASCII case-insensitive</a>.</p>
<p>CSS uses <a data-link-type=dfn href=#dimension title=dimensions>dimensions</a> to specify
distances (<var><length></var>),
durations (<var><time></var>),
frequencies (<var><frequency></var>),
resolutions (<var><resolution></var>),
and other quantities.
<h2 class="heading settled heading" data-level=5 id=lengths><span class=secno>5 </span><span class=content>
Distance Units: the <a class="production css-code" data-link-type=type href=#length-value title="<length>"><length></a> type</span><a class=self-link href=#lengths></a></h2>
<p>Lengths refer to distance measurements
and are denoted by <dfn class=css-code data-dfn-type=type data-export="" id=length-value><length><a class=self-link href=#length-value></a></dfn> in the property definitions.
A length is a <a data-link-type=dfn href=#dimension title=dimension>dimension</a>.
However, for zero lengths the unit identifier is optional
(i.e. can be syntactically represented as the <a class="production css-code" data-link-type=type href=#number-value title="<number>"><number></a> <span class=css data-link-type=maybe title=0>0</span>).</p>
<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>
<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>
<p>In cases where the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-cascade-3/#used-value title="used value">used</a> length cannot be supported,
user agents must approximate it in the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-cascade-3/#actual-value title="actual value">actual</a> value.</p>
<p>There are two types of length units: <a data-link-type=dfn href=#relative-length title="relative length">relative</a> and <a data-link-type=dfn href=#absolute-length title="absolute length">absolute</a>.</p>
<h3 class="heading settled heading" data-level=5.1 id=relative-lengths><span class=secno>5.1 </span><span class=content>
Relative lengths</span><a class=self-link href=#relative-lengths></a></h3>
<p><dfn data-dfn-type=dfn data-noexport="" id=relative-length title="relative length">Relative length units<a class=self-link href=#relative-length></a></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>
<p>The relative units are:</p>
<table class=data>
<caption>Informative Summary of Relative Units</caption>
<thead>
<tr><th>unit<th>relative to
</thead>
<tbody>
<tr><td><a class=css data-link-type=maybe href=#em title=em>em</a>
<td>font size of the element
<tr><td><a class=css data-link-type=maybe href=#ex title=ex>ex</a>
<td>x-height of the element’s font
<tr><td><a class=css data-link-type=maybe href=#ch title=ch>ch</a>
<td>width of the "0" (ZERO, U+0030) glyph in the element’s font
<tr><td><a class=css data-link-type=maybe href=#rem title=rem>rem</a>
<td>font size of the root element
<tr><td><a class=css data-link-type=maybe href=#vw title=vw>vw</a>
<td>1% of viewport’s width
<tr><td><a class=css data-link-type=maybe href=#vh title=vh>vh</a>
<td>1% viewport’s height
<tr><td><a class=css data-link-type=maybe href=#vmin title=vmin>vmin</a>
<td>1% of viewport’s smaller dimension
<tr><td><a class=css data-link-type=maybe href=#vmax title=vmax>vmax</a>
<td>1% of viewport’s larger dimension
</tbody>
</table>
<p>Child elements do not inherit the relative values as specified for their parent;
they inherit the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-cascade-3/#computed-value title="computed values">computed values</a>.</p>
<h4 class="heading settled heading" data-level=5.1.1 id=font-relative-lengths><span class=secno>5.1.1 </span><span class=content>
Font-relative lengths: the <a class=css data-link-type=maybe href=#em title=em>em</a>, <a class=css data-link-type=maybe href=#ex title=ex>ex</a>, <a class=css data-link-type=maybe href=#ch title=ch>ch</a>, <a class=css data-link-type=maybe href=#rem title=rem>rem</a> units</span><a class=self-link href=#font-relative-lengths></a></h4>
<p>Aside from <a class=css data-link-type=maybe href=#rem title=rem>rem</a> (which refers to the font-size of the root element),
the font-relative lengths refer to the font metrics of the element on which they are used.
The exception is when they occur in the value of the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-size title=font-size>font-size</a> 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 <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font title=font>font</a> property,
if the element has no parent).</p>
<dl data-export="">
<dt><dfn data-dfn-type=dfn data-export="" id=em title=em>em unit<a class=self-link href=#em></a></dfn>
<dd>
Equal to the computed value of the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-size title=font-size>font-size</a> property of the element on which it is used.
<div class=example>
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:</p>
<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 data-dfn-type=dfn data-export="" id=ex title=ex>ex unit<a class=self-link href=#ex></a></dfn>
<dd>
Equal to the used x-height of the <a href=http://www.w3.org/TR/css3-fonts/#first-available-font>first available font</a>. <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3-fonts title=biblio-css3-fonts>[CSS3-FONTS]</a>
The x-height is so called because it is often equal to the height of the lowercase "x".
However, an <a class=css data-link-type=maybe href=#ex title=ex>ex</a> is defined even for fonts that do not contain an "x".
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 data-dfn-type=dfn data-export="" id=ch title=ch>ch unit<a class=self-link href=#ch></a></dfn>
<dd>
Equal to the used advance measure of the "0" (ZERO, U+0030) glyph
found in the font used to render it.
In the cases where it is impossible or impractical to determine the measure of the "0" glyph,
a value of 0.5em must be assumed.
<dt><dfn data-dfn-type=dfn data-export="" id=rem title=rem>rem unit<a class=self-link href=#rem></a></dfn>
<dd>
Equal to the computed value of <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-size title=font-size>font-size</a> on the root element.
When specified on the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-size title=font-size>font-size</a> property of the root element,
the <a class=css data-link-type=maybe href=#rem title=rem>rem</a> units refer to the property’s <em>initial value</em>.
</dl>
<h4 class="heading settled heading" data-level=5.1.2 id=viewport-relative-lengths><span class=secno>5.1.2 </span><span class=content>
Viewport-percentage lengths: the <a class=css data-link-type=maybe href=#vw title=vw>vw</a>, <a class=css data-link-type=maybe href=#vh title=vh>vh</a>, <a class=css data-link-type=maybe href=#vmin title=vmin>vmin</a>, <a class=css data-link-type=maybe href=#vmax title=vmax>vmax</a> units</span><a class=self-link href=#viewport-relative-lengths></a></h4>
<p>The viewport-percentage lengths are relative to the size of the
<a href=http://www.w3.org/TR/CSS21/visudet.html#containing-block-details>initial containing block</a>.
When the height or width of the initial containing block is changed,
they are scaled accordingly.
However, when the value of <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-overflow-3/#overflow0 title=overflow>overflow</a> on the root element is <span class=css data-link-type=maybe title=auto>auto</span>,
any scroll bars are assumed not to exist.
<span class=note>Note that the initial containing block’s size is affected by the presence of scrollbars on the viewport.</span></p>
<p>For paged media, the exact definition of the viewport-percentage lengths
is deferred to <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3page title=biblio-css3page>[CSS3PAGE]</a>.</p>
<dl data-export="">
<dt><dfn data-dfn-type=dfn data-export="" id=vw title=vw>vw unit<a class=self-link href=#vw></a></dfn>
<dd>
Equal to 1% of the width of the initial containing block.
<div class=example>
In the example below, if the width of the viewport is 200mm,
the font size of <code>h1</code> elements will be 16mm
(i.e. (8×200mm)/100).
<pre>h1 { font-size: 8vw }</pre>
</div>
<dt><dfn data-dfn-type=dfn data-export="" id=vh title=vh>vh unit<a class=self-link href=#vh></a></dfn>
<dd>
Equal to 1% of the height of the initial containing block.
<dt><dfn data-dfn-type=dfn data-export="" id=vmin title=vmin>vmin unit<a class=self-link href=#vmin></a></dfn>
<dd>
Equal to the smaller of <a class=css data-link-type=maybe href=#vw title=vw>vw</a> or <a class=css data-link-type=maybe href=#vh title=vh>vh</a>.
<dt><dfn data-dfn-type=dfn data-export="" id=vmax title=vmax>vmax unit<a class=self-link href=#vmax></a></dfn>
<dd>
Equal to the larger of <a class=css data-link-type=maybe href=#vw title=vw>vw</a> or <a class=css data-link-type=maybe href=#vh title=vh>vh</a>.
</dl>
<h3 class="heading settled heading" data-level=5.2 id=absolute-lengths><span class=secno>5.2 </span><span class=content>
Absolute lengths: the <a class=css data-link-type=maybe href=#cm title=cm>cm</a>, <a class=css data-link-type=maybe href=#mm title=mm>mm</a>, <a class=css data-link-type=maybe href=#q title=q>q</a>, <a class=css data-link-type=maybe href=#in title=in>in</a>, <a class=css data-link-type=maybe href=#pt title=pt>pt</a>, <a class=css data-link-type=maybe href=#pc title=pc>pc</a>, <a class=css data-link-type=maybe href=#px title=px>px</a> units</span><a class=self-link href=#absolute-lengths></a></h3>
<p>The <dfn data-dfn-type=dfn data-noexport="" id=absolute-length title="absolute length">absolute length units<a class=self-link href=#absolute-length></a></dfn> are fixed in relation to each other
and anchored to some physical measurement.
They are mainly useful when the output environment is known.
The absolute units consist of
the <dfn data-dfn-type=dfn data-noexport="" id=physical-units>physical units<a class=self-link href=#physical-units></a></dfn> (<a class=css data-link-type=maybe href=#in title=in>in</a>, <a class=css data-link-type=maybe href=#cm title=cm>cm</a>, <a class=css data-link-type=maybe href=#mm title=mm>mm</a>, <a class=css data-link-type=maybe href=#pt title=pt>pt</a>, <a class=css data-link-type=maybe href=#pc title=pc>pc</a>, <a class=css data-link-type=maybe href=#q title=q>q</a>)
and the <dfn data-dfn-type=dfn data-noexport="" id=visual-angle-unit>visual angle unit<a class=self-link href=#visual-angle-unit></a></dfn> (<a class=css data-link-type=maybe href=#px title=px>px</a>):</p>
<table class=data data-export="">
<thead>
<tr><th>unit
<th>name
<th>equivalence
<tbody>
<tr><th><dfn data-dfn-type=dfn data-export="" id=cm>cm<a class=self-link href=#cm></a></dfn>
<td>centimeters
<td>1cm = 96px/2.54
<tr><th><dfn data-dfn-type=dfn data-export="" id=mm>mm<a class=self-link href=#mm></a></dfn>
<td>millimeters
<td>1mm = 1/10th of 1cm
<tr><th><dfn data-dfn-type=dfn data-export="" id=q>q<a class=self-link href=#q></a></dfn>
<td>quarter-millimeters
<td>1q = 1/40th of 1cm
<tr><th><dfn data-dfn-type=dfn data-export="" id=in>in<a class=self-link href=#in></a></dfn>
<td>inches
<td>1in = 2.54cm = 96px
<tr><th><dfn data-dfn-type=dfn data-export="" id=pc>pc<a class=self-link href=#pc></a></dfn>
<td>picas
<td>1pc = 1/6th of 1in
<tr><th><dfn data-dfn-type=dfn data-export="" id=pt>pt<a class=self-link href=#pt></a></dfn>
<td>points
<td>1pt = 1/72th of 1in
<tr><th><dfn data-dfn-type=dfn data-export="" id=px title="px|pixel unit">px<a class=self-link href=#px></a></dfn>
<td>pixels
<td>1px = 1/96th of 1in
</table>
<div class=example>
<pre>h1 { margin: 0.5in } /* inches */
h2 { line-height: 3cm } /* centimeters */
h3 { word-spacing: 4mm } /* millimeters */
h3 { letter-spacing: 1Q } /* quarter-millimeters */
h4 { font-size: 12pt } /* points */
h4 { font-size: 1pc } /* picas */
p { font-size: 12px } /* px */
</pre>
</div>
<p>For a CSS device, these dimensions are anchored either
<ul>
<li>(i) by relating the <a data-link-type=dfn href=#physical-units title="physical units">physical units</a> to their physical measurements, or
<li>(ii) by relating the <a data-link-type=dfn href=#px title="pixel unit">pixel unit</a> to the <a data-link-type=dfn href=#reference-pixel title="reference pixel">reference pixel</a>.
</ul><p></p>
<p>For print media and similar high-resolution devices,
the anchor unit should be one of the standard physical units (inches, centimeters, etc).
For lower-resolution devices,
and devices with unusual viewing distances,
it is recommended instead that the anchor unit be the pixel unit.
For such devices it is recommended that the pixel unit
refer to the whole number of device pixels that best approximates the reference pixel.</p>
<p class=note>Note: Note that if the anchor unit is the pixel unit,
the physical units might not match their physical measurements.
Alternatively if the anchor unit is a physical unit,
the pixel unit might not map to a whole number of device pixels.</p>
<p class=note>Note: Note that this definition of the pixel unit and the physical units
differs from previous versions of CSS.
In particular, in previous versions of CSS the pixel unit and the physical units
were not related by a fixed ratio:
the physical units were always tied to their physical measurements
while the pixel unit would vary to most closely match the reference pixel.
(This change was made because too much existing content relies on the assumption of 96dpi,
and breaking that assumption breaks the content.)</p>
<p>The <dfn data-dfn-type=dfn data-export="" id=reference-pixel>reference pixel<a class=self-link href=#reference-pixel></a></dfn> is the visual angle of one pixel on a device with a pixel density of 96dpi
and a distance from the reader of an arm’s length.
For a nominal arm’s length of 28 inches,
the visual angle is therefore about 0.0213 degrees.
For reading at arm’s length,
1px thus corresponds to about 0.26 mm (1/96 inch).</p>
<p>The image below illustrates the effect of viewing distance on the size of a reference pixel:
a reading distance of 71 cm (28 inches)
results in a reference pixel of 0.26 mm,
while a reading distance of 3.5 m (12 feet)
results in a reference pixel of 1.3 mm.</p>
<figure>
<img alt="This diagram illustrates how the definition of a pixel
depends on the users distance from the viewing surface
(paper or screen).
The image depicts the user looking at two planes, one
28 inches (71 cm) from the user, the second 140 inches
(3.5 m) from the user. An expanding cone is projected
from the user’s eye onto each plane. Where the cone
strikes the first plane, the projected pixel is 0.26 mm
high. Where the cone strikes the second plane, the
projected pixel is 1.4 mm high." src=pixel1.png>
<figcaption>Showing that pixels must become larger if the viewing distance increases</figcaption>
</figure>
<p>This second image illustrates the effect of a device’s resolution