-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
1969 lines (1593 loc) · 138 KB
/
Overview.html
File metadata and controls
1969 lines (1593 loc) · 138 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
53
4026
8
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
<!DOCTY
4B74
PE 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,
<span class=dt-updated><span class=value-title title=20141016>16 October 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:<dd><span><a href="mailto:www-style@w3.org?subject=[css-values] feedback">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><dt>Editors:<dd><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
C04C
><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://fantasai.inkedblade.net/contact>fantasai</a></div><dt>Former Editors:<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><dt>Issue Tracking:<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></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 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>.
<p>
This document is governed by the <a href=http://www.w3.org/2014/Process-20140801/>1 August 2014 W3C Process Document</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" 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> <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></ul><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><a href=#component-combinators><span class=secno>2.2</span> <span class=content>
Component value combinators</span></a><li><a href=#component-multipliers><span class=secno>2.3</span> <span class=content>
Component value multipliers</span></a><li><a href=#combinator-multiplier-patterns><span class=secno>2.4</span> <span class=content>
Combinator and Multiplier Patterns</span></a><li><a href=#component-whitespace><span class=secno>2.5</span> <span class=content>
Component values and white space</span></a><li><a href=#value-examples><span class=secno>2.6</span> <span class=content>
Property value examples</span></a></ul><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>initial</span> and <span class=css>inherit</span></span></a></ul><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><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><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><a href=#url-modifiers><span class=secno>3.4.2</span> <span class=content>
URL Modifiers</span></a></ul></ul><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><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><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><a href=#dimensions><span class=secno>4.4</span> <span class=content>
Numbers with Units: <span data-link-type=dfn title=dimensions>dimensions</span></span></a></ul><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><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></ul><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>in</span>, <span class=css>pt</span>, <span class=css>pc</span>, <span class=css>px</span> units</span></a></ul><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><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><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>, <span class=css>kHz</span> units</span></a><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></ul><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><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><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></ul><li><a href=#functional-notation><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><a href=#calc-type-checking><span class=secno>8.1.2</span> <span class=content>
Type Checking</span></a><li><a href=#calc-computed-value><span class=secno>8.1.3</span> <span class=content>
Computed Value</span></a><li><a href=#calc-range><span class=secno>8.1.4</span> <span class=content>
Range Checking</span></a></ul><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><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></ul><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></ul><li><a href=#acknowledgments><span class=secno></span> <span class=content>
Acknowledgments</span></a><li><a href=#changes><span class=secno></span> <span class=content>
Changes</span></a><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><a href=#conformance-classes><span class=secno></span> <span class=content>
Conformance classes</span></a><li><a href=#partial><span class=secno></span> <span class=content>
Partial implementations</span></a><li><a href=#experimental><span class=secno></span> <span class=content>
Experimental implementations</span></a><li><a href=#testing><span class=secno></span> <span class=content>
Non-experimental implementations</span></a></ul><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><a href=#informative><span class=secno></span> <span class=content>Informative References</span></a></ul><li><a href=#index><span class=secno></span> <span class=content>Index</span></a></ul></div>
<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 <span class=css>></span>), and information on how
they can be combined.
Generic data types (<a class="production css" 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" data-link-type=type title="<spacing-limit>"><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 valu
4B74
e 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>, <span class=css>disc</span>, etc.),
which appear literally, without quotes (e.g. <code>auto</code>)
<li>
basic data types, which appear between <span class=css><</span> and <span class=css>></span>
(e.g., <a class="production css" data-link-type=type href=#length-value title="<length>"><length></a>, <a class="production css" 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>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><</span> and <span class=css>></span>,
as in <a class="production css" data-link-type=type title="<spacing-limit>"><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 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-for="" data-link-type=grammar href=#mult-opt title=?>?</a> <a class=prod-punc data-link-for="" data-link-type=grammar href=#comb-comma title=,>,</a> second<a class=prod-punc data-link-for="" data-link-type=grammar href=#mult-opt title=?>?</a> <a class=prod-punc data-link-for="" data-link-type=grammar href=#comb-comma title=,>,</a> third<a class=prod-punc data-link-for="" data-link-type=grammar href=#mult-opt title=?>?</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 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" 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" 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><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>*</span>, <span class=css>+</span>, 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 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" 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>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 title="<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>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>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>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>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>#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>overline underline</span>
<tr><td><a class=css 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><a class=css data-link-type=maybe futuraU0002C="" gill="" sans-serifU00022="" sansU00022U0002C="" title="">"Gill Sans", Futura, sans-serif</a>
<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>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>3px 3px rgba(50%, 50%, 50%, 50%), lemonchiffon 0 0 4px inset</span>
</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 title="<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 <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" data-level=3.1.1 id=common-keywords><span class=secno>3.1.1. </span><span class=content>
CSS-wide keywords: <span class=css>initial</span> and <span class=css>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>initial</span> keyword represents the value specified as the property’s initial value.
The <span class=css>inherit</span> keyword represents the computed value of the property on the element’s parent.
The <span class=css>unset</span> keyword acts as either <span class=css>inherit</span> or <span class=css>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=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 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 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>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 title="CSS-wide keywords">CSS-wide keywords</a> are not valid <a class="production css" data-link-type=type href=#identifier-value title="<custom-ident>"><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 title="<custom-ident>"><custom-ident></a>.</p>
<p>Specifications using <a class="production css" 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" 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" 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" 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" 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" 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 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 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 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=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" data-level=3.4 id=urls><span class=secno>3.4. </span><span class=content>
Resource Locators: the <a class="production css" 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 href=#functional-notation>functional notation</a>
denoted by <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a>.
The syntax of a <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> is:</p>
<pre class=prod><dfn data-dfn-type=type data-export="" id=url-value><url><a class=self-link href=#url-value></a></dfn> = url( <a class=production data-link-type=type href=#string-value title="<string>"><string></a> <a class=production data-link-type=type href=#typedef-url-modifier title="<url-modifier>"><url-modifier></a><a class=prod-punc data-link-for="" data-link-type=grammar href=#mult-zero-plus title=*>*</a> )</pre>
<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>
</div>
<p>In addition to the syntax defined above,
a <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> can sometimes be written in other ways:</p>
<ul><li data-md=""><p>For legacy reasons,
a <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> can be written without quotation marks around the URL itself.
This syntax is <a data-link-spec=css-syntax data-link-type=dfn href=http://dev.w3.org/csswg/css-syntax-3/#consume-a-url-token title="consume a url token">specially-parsed</a>,
and produces a <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-url-token title="<url-token>"><url-token></a> rather than a <a data-link-type=dfn href=http://dev.w3.org/csswg/css-syntax-3/#function title=function>function</a> syntactically. <a data-biblio-type=normative data-link-type=biblio href=#biblio-css3syn title=CSS3SYN>[CSS3SYN]</a></p>
<li data-md=""><p>Some CSS contexts, such as <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-cascade-3/#at-ruledef-import title=@import>@import</a>, allow a <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> to be represented by a <a class="production css" data-link-type=type href=#string-value title="<string>"><string></a> instead.
This behaves identically to writing a <span class=css>url()</span> function containing that string.</p>
</ul>
<p>Because these alternate ways of writing a <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> are not <a data-link-type=dfn href=#functional-notation0 title="functional notations">functional notations</a>,
they cannot accept any <a class="production css" data-link-type=type href=#typedef-url-modifier title="<url-modifier>"><url-modifier></a>s.</p>
<p class=note>Note: The special parsing rules for the legacy quotation mark-less <a class="production css" data-link-type=type href=#url-value title="<url>"><url></a> syntax
means that parentheses, whitespace characters, single quotes (') and double quotes (") appearing in a URL
must be escaped with a backslash,
e.g. <span class=css>url(open\(parens)</span>, <span class=css>url(close\)parens)</span>.
Depending on the type of URL,
it might also be possible to write these characters as URL-escapes
(e.g. <span class=css>url(open%28parens)</span> or <span class=css>url(close%29parens)</span>)
as described in <a data-biblio-type=informative data-link-type=biblio href=#biblio-url title=URL>[URL]</a>.
(If written as a normal function containing a string, ordinary string escaping rules apply;
only newlines and the character used to quote the string need to be escaped.)</p>
<h4 class="heading settled" data-level=3.4.1 id=relative-urls><span class=secno>3.4.1. </span><span class=content>
Relative URLs</span><a class=self-link href=#relative-urls></a></h4>
<p>In order to create modular style sheets that are not dependent on
the absolute location of a resource, authors should use relative URLs.
Relative URLs (as defined in <a data-biblio-type=normative data-link-type=biblio href=#biblio-url title=URL>[URL]</a>) are resolved to full URLs
using a base URL. RFC 3986, section 3, defines the normative
algorithm for this process.
For CSS style sheets, the base URL 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" 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 URL that the UA cannot resolve to an absolute URL 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>
<h4 class="heading settled" data-level=3.4.2 id=url-modifiers><span class=secno>3.4.2. </span><span class=content>
URL Modifiers</span><a class=self-link href=#url-modifiers></a></h4>
<p>The <span class=css>url()</span> function supports specifying additional <dfn class=css data-dfn-type=type data-export="" id=typedef-url-modifier><url-modifier><a class=self-link href=#typedef-url-modifier></a></dfn>s,
which change the meaning or the interpretation of the URL somehow.
A <a class="production css" data-link-type=type href=#typedef-url-modifier title="<url-modifier>"><url-modifier></a> is either an <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/mediaqueries-4/#typedef-ident title="<ident>"><ident></a> or a <a data-link-type=dfn href=http://dev.w3.org/csswg/css-syntax-3/#function title=function>function</a>.</p>
<p>This specification does not define any <a class="production css" data-link-type=type href=#typedef-url-modifier title="<url-modifier>"><url-modifier></a>s,
but other specs may do so.</p>
<h2 class="heading settled" 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" data-level=4.1 id=integers><span class=secno>4.1. </span><span class=content>
Integers: the <a class="production css" 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 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>0</span> through <span class=css>9</span>
and corresponds to a subset of the <a class="production css" 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=CSS3SYN>[CSS3SYN]</a>.
The first digit of an integer may be immediately preceded by <span class=css>-</span> or <span class=css>+</span>
to indicate the integer’s sign.</p>
<h3 class="heading settled" data-level=4.2 id=numbers><span class=secno>4.2. </span><span class=content>
Real Numbers: the <a class="production css" 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 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" 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" 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=CSS3SYN>[CSS3SYN]</a>.
As with integers, the first character of a number may be immediately preceded by <span class=css>-</span> or <span class=css>+</span>
to indicate the number’s sign.</p>
<h3 class="heading settled" data-level=4.3 id=percentages><span class=secno>4.3. </span><span class=content>
Percentages: the <a class="production css" 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 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" data-link-type=type href=#number-value title="<number>"><number></a>
immediately followed by a percent sign <span class=css>%</span>.
It corresponds to the <a class="production css" 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=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 <a data-link-type=dfn href=http://dev.w3.org/csswg/css-display-3/#containing-block title="containing block">containing block</a>).</p>
<h3 class="heading settled" 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" 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" 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=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" data-level=5 id=lengths><span class=secno>5. </span><span class=content>
Distance Units: the <a class="production css" 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 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" data-link-type=type href=#number-value title="<number>"><number></a> <span class=css>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" 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><span class=css>em</span>
<td>font size of the element
<tr><td><span class=css>ex</span>
<td>x-height of the element’s font
<tr><td><span class=css>ch</span>
<td>width of the "0" (ZERO, U+0030) glyph in the element’s font
<tr><td><span class=css>rem</span>
<td>font size of the root element
<tr><td><span class=css>vw</span>
<td>1% of viewport’s width
<tr><td><span class=css>vh</span>
<td>1% viewport’s height
<tr><td><span class=css>vmin</span>
<td>1% of viewport’s smaller dimension
<tr><td><span class=css>vmax</span>
<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" data-level=5.1.1 id=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 class=self-link href=#font-relative-lengths></a></h4>
<p>Aside from <span class=css>rem</span> (which refers to the font-size of the root element),
the <dfn data-dfn-type=dfn data-export="" id=font-relative-lengths0>font-relative lengths<a class=self-link href=#font-relative-lengths0></a></dfn> 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=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 <span class=css>ex</span> 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 <span class=css>rem</span> units refer to the property’s <em>initial value</em>.
</dl>
<h4 class="heading settled" data-level=5.1.2 id=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 class=self-link href=#viewport-relative-lengths></a></h4>
<p>The <dfn data-dfn-type=dfn data-export="" id=viewport-percentage-lengths>viewport-percentage lengths<a class=self-link href=#viewport-percentage-lengths></a></dfn> 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>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=CSS3PAGE>[
56F0
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 <span class=css>vw</span> or <span class=css>vh</span>.
<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 <span class=css>vw</span> or <span class=css>vh</span>.
</dl>
<h3 class="heading settled" data-level=5.2 id=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>in</span>, <span class=css>pt</span>, <span class=css>pc</span>, <span class=css>px</span> 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> (<span class=css>in</span>, <span class=css>cm</span>, <span class=css>mm</span>, <span class=css>pt</span>, <span class=css>pc</span>, <span class=css>q</span>)
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> (<span class=css>px</span>):</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</p>
<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>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>