-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·1204 lines (845 loc) · 90.5 KB
/
Overview.html
File metadata and controls
executable file
·1204 lines (845 loc) · 90.5 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 Generated Content 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>
</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 Generated Content 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=20141205>5 December 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-content/>http://dev.w3.org/csswg/css-content/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css3-content/>http://www.w3.org/TR/css3-content/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2003/WD-css3-content-20030514/ rel=previous>http://www.w3.org/TR/2003/WD-css3-content-20030514/</a><dt>Feedback:<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-content%5D%20feedback">www-style@w3.org</a> with subject line “<kbd>[css-content] <var>… message topic …</var></kbd>” (<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</a>)</span><dt class=editor>Editors:<dd class=editor><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://fantasai.inkedblade.net/contact>Fantasai</a> (<span class="p-org org">W3C Invited Expert</span>)</div><dd class=editor><div class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:dauwhe@gmail.com>Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>)</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><dd><div class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:ian@hixie.ch>Ian Hickson</a> (<span class="p-org org">Google</span>)</div></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 how to insert content in a document.</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-content%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-content” in the subject,
preferably like this:
“[css-content] <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></div>
<h2 class="no-num no-toc no-ref heading settled" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents role=navigation><ul class=toc role=directory><li><a href=#introduction><span class=secno></span> <span class=content>
Introduction
</span></a><li><a href=#pseudo-elements><span class=secno>1</span> <span class=content>Pseudo-elements (moved)</span></a><li><a href=#inserting-replacing-content><span class=secno>2</span> <span class=content>Inserting and replacing content with the <span class=property data-link-type=propdesc title=content>content</span> property</span></a><ul class=toc><li><a href=#alt-property><span class=secno>2.1</span> <span class=content>
Alternative text for Generated Content: The <span class=property data-link-type=propdesc title=alt>alt</span> property</span></a></ul><li><a href=#replacedContent><span class=secno>3</span> <span class=content>Replaced content</span></a><li><a href=#specifying-quotes><span class=secno>4</span> <span class=content>Specifying quotes with the <span class=property data-link-type=propdesc title=quotes>quotes</span> property</span></a><ul class=toc><li><a href=#inserting-quotes><span class=secno>4.1</span> <span class=content>Inserting quotes with the <span class=property data-link-type=propdesc title=content>content</span> property</span></a></ul><li><a href=#counters><span class=secno>5</span> <span class=content>Automatic counters and numbering: the <span class=property data-link-type=propdesc title=counter-increment>counter-increment</span> and <span class=property data-link-type=propdesc title=counter-reset>counter-reset</span> properties (moved)</span></a><li><a href=#named-strings><span class=secno>6</span> <span class=content>Named strings</span></a><ul class=toc><li><a href=#setting-named-strings-the-string-set-pro><span class=secno>6.1</span> <span class=content>The string-set property</span></a><ul class=toc><li><a href=#content-function-header><span class=secno>6.1.1</span> <span class=content>The <span class=css data-link-type=maybe title=content()>content()</span> function</span></a></ul><li><a href=#using-named-strings><span class=secno>6.2</span> <span class=content>The <span class=css data-link-type=maybe title=string()>string()</span> function</span></a><li><a href=#at-counter-styles><span class=secno>6.3</span> <span class=content>'@counter-styles'</span></a></ul><li><a href=#leaders><span class=secno>7</span> <span class=content>
Leaders
</span></a><ul class=toc><li><a href=#rendering-leaders><span class=secno>7.1</span> <span class=content>
Rendering leaders
</span></a><ul class=toc><li><a href=#procedure-leader><span class=secno>7.1.1</span> <span class=content>
Procedure for rendering leaders
</span></a></ul></ul><li><a href=#cross-references><span class=secno>8</span> <span class=content>
Cross-references
</span></a><ul class=toc><li><a href=#target-counter><span class=secno>8.1</span> <span class=content>
The <span class=css data-link-type=maybe title=target-counter()>target-counter()</span> function
</span></a><li><a href=#target-counters><span class=secno>8.2</span> <span class=content>
The <span class=css data-link-type=maybe title=target-counters()>target-counters()</span> function
</span></a><li><a href=#target-text><span class=secno>8.3</span> <span class=content>
target-text
</span></a></ul><li><a href=#bookmarks><span class=secno>9</span> <span class=content>
Bookmarks
</span></a><ul class=toc><li><a href=#bookmark-level><span class=secno>9.1</span> <span class=content>
bookmark-level
</span></a><li><a href=#bookmark-label><span class=secno>9.2</span> <span class=content>
bookmark-label
</span></a><li><a href=#bookmark-state><span class=secno>9.3</span> <span class=content>
bookmark-state
</span></a></ul><li><a href=#changes><span class=secno>10</span> <span class=content>Changes since the 14 May 2003 Working Draft</span></a><li><a href=#acknowledgments><span class=secno></span> <span class=content>Acknowledgments</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><li><a href=#property-index><span class=secno></span> <span class=content>Property Index</span></a><li><a href=#issues-index><span class=secno></span> <span class=content>Issues Index</span></a></ul></div>
<main>
<h2 class="no-num heading settled" id=introduction><span class=content>
Introduction
</span></h2>
<p>Authors sometimes want user agents to render content that does not come from the document tree. One familiar example of this is numbered headings; the author does not want to mark the numbers up explicitly, she or he wants the user agent to generate them automatically. Counters and markers are used to achieve these effects.</p>
<div class=example>
<pre>h1::before { content: counter(section) ": "; }
</pre>
</div>
<p>Similarly, authors may want the user agent to insert the word "Figure" before the caption of a figure, or "Chapter 7" on a line before the seventh chapter title.</p>
<div class=example>
<pre>chapter { counter-increment: chapter; }
chapter > title::before { content: "Chapter " counter(chapter) "\A"; }
</pre>
</div>
<p>Another common effect is replacing elements with images or other multimedia content. Since not all user agents support all multimedia formats, fallbacks may have to be provided.</p>
<div class=example>
<pre>/* Replace <logo> elements with the site’s logo, using a format
* supported by the UA */
logo { content: url(logo.mov), url(logo.mng), url(logo.png), none; }
/* Replace <figure> elements with the referenced document, or,
* failing that, with either the contents of the alt attribute or the
* contents of the element itself if there is no alt attribute */
figure[alt] { content: attr(href, url), attr(alt); }
figure:not([alt]) { content: attr(href, url), contents; }
</pre>
</div>
<h2 class="heading settled" data-level=1 id=pseudo-elements><span class=secno>1. </span><span class=content>Pseudo-elements (moved)</span><a class=self-link href=#pseudo-elements></a></h2>
<p class=issue id=issue-eb9058b4><a class=self-link href=#issue-eb9058b4></a>Now described in <span data-biblio-type=informative data-link-type=biblio title=CSS-PSEUDO-4>[CSS-PSEUDO-4]</span></p>
<h2 class="heading settled" data-level=2 id=inserting-replacing-content><span class=secno>2. </span><span class=content>Inserting and replacing content with the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property</span><a class=self-link href=#inserting-replacing-content></a></h2>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-content>content<a class=self-link href=#propdef-content></a></dfn><tr><th>Value:<td class=prod>[ [ <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css2/syndata.html#value-def-uri title="<uri>"><uri></a> ] '<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a>' ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-zero-plus title=*>*</a> [ normal <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> none <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> inhibit <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <content-list> ]<tr><th>Initial:<td>normal<tr><th>Applies to:<td>elements, pseudo-elements, and page margin boxes.<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>all<tr><th>Computed value:<td>As specified below.<tr><th>Animatable:<td>no</table>
<p class=issue id=issue-888fe5ef><a class=self-link href=#issue-888fe5ef></a>We should be clear about which pseudo-elements can use the content property.
<p>The <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property dictates what is rendered inside the element or pseudo-element. It takes a comma separated list of URIs, followed by a space separated list of tokens. If there are multiple URIs provided, then each is tried in turn until a value which is both available and supported is found. The last value is used as a fallback if the others fail.</p>
<dl><dt data-md=""><p><a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css2/syndata.html#value-def-uri title="<uri>"><uri></a>;</p>
<dd data-md=""><p>For URIs other than URIs in the last comma separated section of the value, if the URI is available and the format is supported, then the element or pseudo-element becomes a replaced element, otherwise, the next item in the comma separated list is used, if any.</p>
<dd data-md=""><div class=example>
<pre>h1 { content: url(header/mng), url(header/png), none; }
</pre>
</div></dl>
<dl><dd data-md=""><p>In the example above, if <code>header/mng</code> wasn’t in a supported format, then <code>header/png</code> would have been used instead. In the example above, if <code>header/png</code> wasn’t available either, then the <code><h1></code> element would be empty, as the last alternative is <span class=css>none</span>.<p></p>
<dd data-md=""><p>To make an element fallback on its contents, you have to explicitly give <span class=css>contents</span> as a fallback:</p>
<dd data-md=""><div class=example>
<pre>content: url(1), url(2), url(3), contents;</pre></div></dl>
<dl><dd data-md=""><p class=issue id=issue-741dba94><a class=self-link href=#issue-741dba94></a>What happens when no formats are supported, and the author does not explicitly indicate a fallback?</p>
<dd data-md=""><p class=issue id=issue-f9a4110d><a class=self-link href=#issue-f9a4110d></a>Why doesn’t an element fallback to <span class=css>contents</span> unless an author explicitly says so?</p>
<dd data-md=""><p>If the URI is part of the last comma separated value in the list, as the second URI in the following example:</p>
<dd data-md=""><div class=example>
<pre>h1 { content: url(welcome), "Welcome to: " url(logo); }</pre></div></dl>
<dl><dd data-md=""><p>...then if the file is available and the format is supported, then an anonymous replaced inline element is inserted, otherwise the image is ignored (as if it hadn’t been given at all).</p>
<dd data-md=""><p class=issue id=issue-1367c805><a class=self-link href=#issue-1367c805></a>There appears to be some change from <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a> which says, "If the user agent cannot display the resource it must either leave it out as if it were not specified or display some indication that the resource cannot be displayed." Are we now saying that a user agent cannot display a missing image graphic in this situation?</p>
<dd data-md=""><p>When a URI is used as replaced content, it <a href=#replacedContent>affects the generation</a> of <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-pseudo-4/#selectordef-before title=::before>::before</a> and <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-pseudo-4/#selectordef-after title=::after>::after</a> pseudo-elements.</p>
<dt data-md=""><p><dfn data-dfn-type=dfn data-noexport="" id=content-propertynormal title="'content-property'!!'normal'">normal<a class=self-link href=#content-propertynormal></a></dfn></p>
<dd data-md=""><p>For an element, this computes to <span class=css>contents</span>.<p></p>
<dd data-md=""><p>For <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-pseudo-4/#selectordef-before title=::before>::before</a> and <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-pseudo-4/#selectordef-after title=::after>::after</a>, this computes to <span class=css>inhibit</span>.</p>
<dt data-md=""><p><dfn data-dfn-type=dfn data-noexport="" id=content-propertynone title="'content-property'!!'none'">none<a class=self-link href=#content-propertynone></a></dfn></p>
<dd data-md=""><p>On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty.</p>
<dd data-md=""><p>On pseudo-elements it causes the pseudo-element to have no content.</p>
<dd data-md=""><p>In neither case does it prevent any pseudo-elements which have this element or pseudo-element as a superior from being generated.</p>
<dt data-md=""><p><dfn data-dfn-type=dfn data-noexport="" id=content-propertyinhibit title="'content-property'!!'inhibit'">inhibit<a class=self-link href=#content-propertyinhibit></a></dfn></p>
<dd data-md=""><p>On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty.</p>
<dd data-md=""><p>On pseudo-elements, this inhibits the creation of the pseudo-element, as if <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/visuren.html#propdef-display title=display>display</a> computed to <span class=css>none</span>.</p>
<dd data-md=""><p>In both cases, this further inhibits the creation of any pseudo-elements which have this pseudo-element as a superior.</p>
<dd data-md=""><p class=issue id=issue-6a9516a9><a class=self-link href=#issue-6a9516a9></a>Is <span class=css>inhibit</span> still necessary, in the absence of multiple pseudo-elements?</p>
<dt data-md=""><p><dfn class=css data-dfn-type=type data-export="" id=typedef-content-list><content-list><a class=self-link href=#typedef-content-list></a></dfn></p>
<dd data-md=""><p>[ <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> | contents | attr(<identifier>) | <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css2/syndata.html#value-def-uri title="<uri>"><uri></a> | counter() | counters() | string() | open-quote | close-quote | no-open-quote | no-close-quote | date() | time() | document-url | target-counter() | target-counters() | target-text() | leader() ]+</p>
<dd data-md=""><p>One or more of the following values, concatenated.</p>
<dd data-md=""><dl><dt data-md=""><p><a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>The element or pseudo-element contains the specified string. Occurrences of line-feed or space characters in the string are handled according to the properties given in the <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3text title=CSS3TEXT>[CSS3TEXT]</a> module.</p>
</dl>
<dd data-md=""><dl><dd data-md=""><p>If the value is the empty string, and the element or pseudo-element’s <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/visuren.html#propdef-display title=display>display</a> property computes to anything but <span class=css>inline</span>, then the element or pseude-element contains an empty anonymous inline box, otherwise the element contains an empty string.</p>
</dl>
<dd data-md=""><dl><dd data-md=""><p>(This is a formal way of saying that an empty string is different from <span class=css>none</span> in that it forces the creation of a line box, even if the line box would be empty.)</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p><dfn data-dfn-type=dfn data-noexport="" id=content-propertycontents title="'content-property'!!'contents'">contents<a class=self-link href=#content-propertycontents></a></dfn></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>The element’s descendents. Since this can only be used once per element (you can’t duplicate the children if, e.g., one is a plugin or form control), it is handled as follows:</p>
</dl>
<dd data-md=""><dl><dd data-md=""><p class=issue id=issue-d35a77d5><a class=self-link href=#issue-d35a77d5></a>Note that the Prince PDF Formatter does allow the contents of an element to also be used in a pseudo-element.</p>
</dl>
<dd data-md=""><dl><dd data-md=""><dl><dt data-md=""><p>If set on the element:</p>
</dt></dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>Always honoured. Note that this is the default, since the initial value of <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> is <span class=css>normal</span> and <span class=css>normal</span> computes to <span class=css>contents</span> on an element.</p>
</dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dt data-md=""><p>If set on one of the element’s other pseudo-elements:</p>
</dt></dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>Check to see that it is not set on a "previous" pseudo-element, in the following order, depth first:</p>
</dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><ol><li data-md=""><p>the element itself</p>
<li data-md=""><p>::before</p>
<li data-md=""><p>::after</p>
</ol></dl>
</dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>If it is already used, then it evaluates to nothing (like <span class=css>none</span>). Only pseudo-elements that are actually generated are checked.</p>
</dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>In the following case:</p>
</dl></dl><dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><div class=example>
<pre>foo { content: normal; } /* this is the initial value */
foo::after { content: contents; }
</pre></div></dl></dl></dl>
<dl><dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>...the element’s <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property would compute to <span class=css>contents</span> and the after pseudo element would have no contents (equivalent to <span class=css>none</span>) and thus would not appear.</p>
</dl></dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><div class=example>
<pre>foo { content: none; }
foo::after { content: contents; }
</pre></div></dl></dl></dl>
<dl><dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>But in this example, the ::after pseudo-element will contain the contents of the foo element.</p>
</dl>
</dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p class=issue id=issue-bfc60bbc><a class=self-link href=#issue-bfc60bbc></a>Use cases for suppressing the content on the element and using it in a pseudo-element would be welcome.</p>
</dl>
</dl>
<dd data-md=""><dl><dd data-md=""><dl><dd data-md=""><p>Note that while it is useless to include <span class=css>contents</span> twice in a single <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property, that is not a parse error. The second occurrence simply has no effect, as it has already been used. It is also not a parse error to use it on a marker pseudo-element, it is only during the rendering stage that it gets treated like <span class=css>none</span>.</p>
</dl>
</dl>
<dd data-md=""><dl><dt data-md=""><p>'counter()' and 'counters()'</p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>Inserts the values of 'counter()' and/or 'counters()' functions. See <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3list title=CSS3LIST>[CSS3LIST]</a> for more information.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p>'string()'</p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>Inserts the value of a named string. See the section on <a href=#named-strings>named strings</a> for more information.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p><span class=css>open-quote</span> and <span class=css>close-quote</span></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>These values are replaced by the appropriate string from the <a class=property data-link-type=propdesc href=#propdef-quotes title=quotes>quotes</a> property. See the section on <a href=#specifying-quotes>quotes</a> for more information.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p><span class=css>no-open-quote</span> and <span class=css>no-close-quote</span></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>Inserts nothing (as in <span class=css>none</span>), but increments (decrements) the level of nesting for quotes. See the section on <a href=#specifying-quotes>quotes</a> for more information.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p><datetime></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>Dates and times can be specified with two functions, 'date()' and 'time()'. See the section on dates and times for more information.</p>
</dl></dl>
<p class=issue id=issue-1a274e78><a class=self-link href=#issue-1a274e78></a>There is no section on dates and times yet.</p>
<dl><dd data-md=""><dl><dt data-md=""><p><dfn data-dfn-type=dfn data-noexport="" id=document-url>document-url<a class=self-link href=#document-url></a></dfn></p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>The URI of the current document. For local files, this may simply be the local file name.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p>'target-counter()', 'target-counters()', and 'target-text()'</p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>See the section on <a href=#cross-references>cross-references</a> for more information.</p>
</dl>
<dd data-md=""><dl><dt data-md=""><p>'leader()'</p>
</dt></dl>
<dd data-md=""><dl><dd data-md=""><p>Inserts a leader. See the section on <a href=#leaders>leaders</a> for more information.</p>
</dl>
</dl>
<h3 class="heading settled" data-level=2.1 id=alt-property><span class=secno>2.1. </span><span class=content>
Alternative text for Generated Content: The <a class=property data-link-type=propdesc href=#propdef-alt title=alt>alt</a> property</span><a class=self-link href=#alt-property></a></h3>
<p>The generated content of a ::before or ::after element is not always appropriate for assistive technology. In these cases, alternative text can be provided using the <a class=property data-link-type=propdesc href=#propdef-alt title=alt>alt</a> property. The <a class=property data-link-type=propdesc href=#propdef-alt title=alt>alt</a> property applies only to the same elements the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property applies to.</p>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-alt>alt<a class=self-link href=#propdef-alt></a></dfn><tr><th>Value:<td class=prod>none <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a><tr><th>Initial:<td>none<tr><th>Applies to:<td>::before and ::after pseudo-elements<tr><th>Inherited:<td>no<tr><th>Percentages:<td>n/a<tr><th>Media:<td>visual<tr><th>Computed value:<td>as specified<tr><th>Animatable:<td>no</table>
<dl data-dfn-for=alt-content-property data-dfn-type=value>
<dt>none</dt>
<dd>No alternative text</dd>
<dt><a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a></dt>
<dd>The alternative text is the <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a>. This can be the empty string.</dd>
</dl>
<p>When the alt property computes to anything other than none, the alternative <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> should be used instead of the value of the contents property by assistive technology.</p>
<div class=example>
<p>Here the content property is an image, so the alt property is required to provide alternative text.</p>
<pre>.new::before {
content: url(./img/star.png);
alt: "New!";
}
</pre>
</div>
<div class=example>
<p>If the pseudo-element is purely decorative and its function is covered elsewhere, setting alt to the empty string can avoid reading out the decorative element. Here the ARIA attribute will be spoken as "collapsed". Without the empty string alt value, the content would also be spoken as "Black right-pointing pointer".</p>
<pre>.expandable::before {
content: "\25BA"; /* a.k.a. ► */
alt: "";
/* aria-expanded="false" already in DOM,
so this pseudo-element is decorative */
}
</pre>
</div>
<h2 class="heading settled" data-level=3 id=replacedContent><span class=secno>3. </span><span class=content>Replaced content</span><a class=self-link href=#replacedContent></a></h2>
<p>If the computed value of the part of the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property that ends up being used is a single URI, then the element or pseudo-element is a replaced element. The box model defines different rules for the layout of replaced elements than normal elements. Replaced elements do not have '::before' and '::after' pseudo-elements; the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property in the case of replaced content replaces the entire contents of the element’s box.</p>
<h2 class="heading settled" data-level=4 id=specifying-quotes><span class=secno>4. </span><span class=content>Specifying quotes with the <a class=property data-link-type=propdesc href=#propdef-quotes title=quotes>quotes</a> property</span><a class=self-link href=#specifying-quotes></a></h2>
<p>HTML has long had the <code>q</code> element, used to delimit quotations. The <span class=css>quotes</span> property, in conjunction with the various quote values of the content property, can be used to properly style such quotations.</p>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-quotes>quotes<a class=self-link href=#propdef-quotes></a></dfn><tr><th>Value:<td class=prod>[ <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> none<tr><th>Initial:<td>depends on user agent<tr><th>Applies to:<td>all elements<tr><th>Inherited:<td>yes<tr><th>Percentages:<td>n/a<tr><th>Media:<td>all<tr><th>Computed value:<td>specified value<tr><th>Animatable:<td>no</table>
<p class=issue id=issue-477f4349><a class=self-link href=#issue-477f4349></a>The previous ED had an initial value of <span class=css>text</span>, which was an error. <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a> has initial value of "depends on user agent". Do we use <span class=css>auto</span> for things like this, or is it just a UA stylesheet issue?</p>
<p>This property specifies quotation marks for any number of embedded quotations. Values have the following meanings:</p>
<dl>
<dt><dfn data-dfn-type=dfn data-noexport="" id=quote-none-value>none<a class=self-link href=#quote-none-value></a></dfn></dt>
<dd>The <span class=css>open-quote</span> and <span class=css>close-quote</span> values of the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property produce no quotations marks, as if they were <span class=css>no-open-quote</span> and <span class=css>no-close-quote</span> respectively.</dd>
<dt>[ <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> ]+</dt>
<dd>Values for the <span class=css>open-quote</span> and <span class=css>close-quote</span> values of the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property are taken from this list of pairs of quotation marks (opening and closing). The first (leftmost) pair represents the outermost level of quotation, the second pair the first level of embedding, etc. The user agent must apply the appropriate pair of quotation marks according to the level of embedding.</dd>
</dl>
<div class=example>
<p>For example, applying the following style sheet:</p>
<pre>/* Specify pairs of quotes for two levels in two languages */
:lang(en) > q { quotes: '"' '"' "'" "'" }
:lang(no) > q { quotes: "«" "»" "’" "’" }
/* Insert quotes before and after Q element content */
q::before { content: open-quote }
q::after { content: close-quote }
</pre>
<p>to the following HTML fragment:</p>
<pre class=html-example><html lang="en">
<head>
<title>Quotes</title>
</head>
<body>
<p><q>Quote me!</q></p>
</body>
</html>
</pre>
<p>would allow a user agent to produce:</p>
<pre>"Quote me!"
</pre>
<p>while this HTML fragment:</p>
<pre class=html-example><html lang="no">
<head>
<title>Quotes</title>
</head>
<body>
<p><q>Trøndere gråter når <q>Vinsjan på kaia</q> blir deklamert.</q></p>
</body>
</html>
</pre>
<p>would produce:</p>
<pre>«Trøndere gråter når ’Vinsjan på kaia’ blir deklamert.»
</pre>
</div>
<h3 class="heading settled" data-level=4.1 id=inserting-quotes><span class=secno>4.1. </span><span class=content>Inserting quotes with the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property</span><a class=self-link href=#inserting-quotes></a></h3>
<p>Quotation marks are inserted in appropriate places in a document with the <span class=css>open-quote</span> and <span class=css>close-quote</span> values of the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property. Each occurrence of <span class=css>open-quote</span> or <span class=css>close-quote</span> is replaced by one of the strings from the value of <a class=property data-link-type=propdesc href=#propdef-quotes title=quotes>quotes</a>, based on the depth of nesting.</p>
<p><span class=css>Open-quote</span> refers to the first of a pair of quotes, <span class=css>close-quote</span> refers to the second. Which pair of quotes is used depends on the nesting level of quotes: the number of occurrences of <span class=css>open-quote</span> in all generated text before the current occurrence, minus the number of occurrences of <span class=css>close-quote</span>. If the depth is 0, the first pair is used, if the depth is 1, the second pair is used, etc. If the depth is greater than the number of pairs, the last pair is repeated.</p>
<p>Note that this quoting depth is independent of the nesting of the source document or the formatting structure.</p>
<p>Some typographic styles require open quotation marks to be repeated before every paragraph of a quote spanning several paragraphs, but only the last paragraph ends with a closing quotation mark. In CSS, this can be achieved by inserting "phantom" closing quotes. The keyword <span class=css>no-close-quote</span> decrements the quoting level, but does not insert a quotation mark.</p>
<div class=example>
<p>The following style sheet puts opening quotation marks on every paragraph in a <code>blockquote</code>, and inserts a single closing quote at the end:
<pre>blockquote p:before { content: open-quote }
blockquote p:after { content: no-close-quote }
blockquote p:last-child::after { content: close-quote }
</pre>
</div>
<p>For symmetry, there is also a <span class=css>no-open-quote</span> keyword, which inserts nothing, but increments the quotation depth by one.</p>
<div class=note role=note><p>If a quotation is in a different language than the surrounding text, it is customary to quote the text with the quote marks of the language of the surrounding text, not the language of the quotation itself.</p>
</div>
<div class=example>
<p>For example, French inside English:
<blockquote>
<p>The device of the order of the garter is “Honi soit qui mal y pense.”
</blockquote>
<p>English inside French:</p>
<blockquote>
<p>Il disait: « Il faut mettre l’action en ‹ fast
forward ›. »
</blockquote>
<p>A style sheet like the following will set the <a class=property data-link-type=propdesc href=#propdef-quotes title=quotes>quotes</a> property so that <span class=css>open-quote</span> and <span class=css>close-quote</span> will work correctly on all elements. These rules are for documents that contain only English, French, or both. One rule is needed for every additional language. Note the use of the child combinator (">") to set quotes on elements based on the language of the surrounding text:</p>
<pre>:lang(fr) > * { quotes: "\00AB\2005" "\2005\00BB" "\2039\2005" "\2005\203A" }
:lang(en) > * { quotes: "\201C" "\201D" "\2018" "\2019" }
</pre>
<p>The quotation marks are shown here in a form that most people will be able to type. If you can type them directly, they will look like this:
<pre>:lang(fr) > * { quotes: "« " " »" "‹ " " ›" }
:lang(en) > * { quotes: "“" "”" "‘" "’" }
</pre>
</div>
<h2 class="heading settled" data-level=5 id=counters><span class=secno>5. </span><span class=content>Automatic counters and numbering: the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#propdef-counter-increment title=counter-increment>counter-increment</a> and <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#propdef-counter-reset title=counter-reset>counter-reset</a> properties (moved)</span><a class=self-link href=#counters></a></h2>
<p class=issue id=issue-60dfe435><a class=self-link href=#issue-60dfe435></a>Now described in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3list title=CSS3LIST>[CSS3LIST]</a></p>
<h2 class="heading settled" data-level=6 id=named-strings><span class=secno>6. </span><span class=content>Named strings</span><a class=self-link href=#named-strings></a></h2>
<p>CSS3 introduces 'named strings', which are the textual equivalent of counters and which have a distinct namespace from counters. Named strings follow the same nesting rules as counters. The <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property accepts values similar to the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property, including the extraction of the current value of counters.</p>
<p>Named strings are a convenient way to pull metadata out of the document for insertion into headers and footers. In HTML, for example, META elements contained in the document HEAD can set the value of named strings. In conjunction with attribute selectors, this can be a powerful mechanism:</p>
<pre>meta[author] { string-set: author attr(author); }
head > title { string-set: title contents; }
@page:left {
@top {
text-align: left;
vertical-align: middle;
content: string(title);
}
}
@page:right {
@top {
text-align: right;
vertical-align: middle;
content: string(author);
}
}
</pre>
<p>The <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property copies the text content of an element into a <span class=css>named string</span>, which functions as a variable. The text content of this named string can be retrieved using the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function. Since these variables may change on a given page, an optional second value for the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function allows authors to choose which value on a page is used.</p>
<h3 class="heading settled" data-level=6.1 id=setting-named-strings-the-string-set-pro><span class=secno>6.1. </span><span class=content>The string-set property</span><a class=self-link href=#setting-named-strings-the-string-set-pro></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-string-set>string-set<a class=self-link href=#propdef-string-set></a></dfn><tr><th>Value:<td class=prod>[[ <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> <a class="production css" data-link-type=type href=#typedef-content-list title="<content-list>"><content-list></a>] [<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> <a class="production css" data-link-type=type href=#typedef-content-list title="<content-list>"><content-list></a>]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-zero-plus title=*>*</a> ] <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> none<tr><th>Initial:<td>none<tr><th>Applies to:<td>all elements, but not pseudo-elements<tr><th>Inherited:<td>no<tr><th>Percentages:<td>N/A<tr><th>Media:<td>all<tr><th>Computed value:<td>specified value<tr><th>Animatable:<td>no</table>
<p>The <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a <span class=css>content-list</span> describing how to construct the value of the named string.</p>
<p><span class=css>content-list</span> expands to one or more of the following values, in any order.</p>
<pre class=prod><dfn data-dfn-type=dfn data-noexport="" id=content-list>content-list<a class=self-link href=#content-list></a></dfn> = [ <string> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <counter()> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <counters()> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <content()> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> attr(<identifier>) ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>
</pre>
<dl data-dfn-for=content-list data-dfn-type=value>
<dt> <string> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#strings>string</a>, as defined in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a> </dd>
<dt> <counter()> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#counter>counter()</a> function, as described in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>.</dd>
<dt> <counters()> </dt>
<dd> A <a href=http://www.w3.org/TR/CSS21/syndata.html#counter>counters()</a> function, as described in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css21 title=CSS21>[CSS21]</a>.</dd>
<dt>content()</dt>
<dd>The <a class=css data-link-type=maybe href=#funcdef-content title=content()>content()</a> function, described below.</dd>
<dt>attr(<identifier>)</dt>
<dd>Returns the string value of the attribute <identifier>, as defined in <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3val title=CSS3VAL>[CSS3VAL]</a></dd>
</dl>
<h4 class="heading settled" data-level=6.1.1 id=content-function-header><span class=secno>6.1.1. </span><span class=content>The <a class=css data-link-type=maybe href=#funcdef-content title=content()>content()</a> function</span><a class=self-link href=#content-function-header></a></h4>
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-content>content()<a class=self-link href=#funcdef-content></a></dfn> = content([text <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> before <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> after <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> first-letter ])
</pre>
<p class=issue id=issue-edcf4ca2><a class=self-link href=#issue-edcf4ca2></a>How do we define the default value for this function?</p>
<dl data-dfn-for=content() data-dfn-type=value>
<dt>text</dt>
<dd>The string value of the element, determined as if <code>white-space: normal</code> had been set. This is the default value</dd>
<dt>before</dt>
<dd>The string value of the <code>::before</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. </dd>
<dt>after</dt>
<dd>The string value of the <code>::after</code> pseudo-element, determined as if <code>white-space: normal</code> had been set. </dd>
<dt>first-letter</dt>
<dd>The first letter of the element, as defined for the <code><a href=http://www.w3.org/TR/css3-selectors/#first-letter>::first-letter</a></code> pseudo-element </dd>
</dl>
<p>The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element’s display value is none). The <dfn data-dfn-type=dfn data-noexport="" id=entry-value>entry value<a class=self-link href=#entry-value></a></dfn> for a page is the assignment in effect at the end of the previous page. The <dfn data-dfn-type=dfn data-noexport="" id=exit-value>exit value<a class=self-link href=#exit-value></a></dfn> for a page is the assignment in effect at the end of the current page.</p>
<p>Whenever the value of the element changes, the value of the named string(s) is updated. User agents must be able to recall many values of the named string, as the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function can return past, current, or future values of the assignment.</p>
<div class=example>
<p>HTML:</p>
<pre><h1>Loomings</h1>
</pre>
<p>CSS:</p>
<pre>h1::before { content: 'Chapter ' counter(chapter); }
h1 { string-set: header content(before) ':' content(text); }
h1::after { content: '.'; }
</pre>
<p>The value of the named string “header” will be “Chapter 1: Loomings”.</p>
</div>
<div class=example>
HTML:
<pre><section title="Loomings">
</pre>
<p>CSS:</p>
<pre>section { string-set: header attr(title) }
</pre>
<p>The value of the “header” string will be “Loomings”.</p>
</div>
<h3 class="heading settled" data-level=6.2 id=using-named-strings><span class=secno>6.2. </span><span class=content>The <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function</span><a class=self-link href=#using-named-strings></a></h3>
<p>The <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function is used to copy the value of a named string to the document, via the <a class=property data-link-type=propdesc href=#propdef-content title=content>content</a> property. This function requires one argument, the name of the named string. Since the value of a named string may change several times on a page (as new instances of the element defining the string appear) an optional second argument indicates which value of the named string should be used.</p>
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-string>string()<a class=self-link href=#funcdef-string></a></dfn> = string( <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> [ <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> [ first <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> start <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> last <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> first-except] ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a> )
</pre>
<p>The second argument of the <a class=css data-link-type=maybe href=#funcdef-string title=string()>string()</a> function is one of the following keywords:</p>
<dl data-dfn-for=string() data-dfn-type=value>
<dt id=string-first><a class=self-link href=#string-first></a>first</dt>
<dd>The value of the first assignment on the page is used. If there is no assignment on the page, the <span class=css>entry value</span> is used. <code>first</code> is the default value.</dd>
<dt id=string-start><a class=self-link href=#string-start></a>start</dt>
<dd>If the element is the first element on the page, the value of the first assignment is used. Otherwise the <span class=css>entry value</span> is used. The <span class=css>entry value</span> may be empty if the element hasn’t yet appeared. </dd>
<dt id=string-last><a class=self-link href=#string-last></a>last</dt>
<dd>The <span class=css>exit value</span> of the named string is used.</dd>
<dt id=string-first-except><a class=self-link href=#string-first-except></a>first-except</dt>
<dd>This is identical to <code>first</code>, except that the empty string is used on the page where the value is assigned.</dd>
</dl>
<div class=example>
CSS:
<pre>@page {
size: 15cm 10cm;
margin: 1.5cm;
@top-left {
content: "first: " string(heading, first);
}
@top-center {
content: "start: " string(heading, start);
}
@top-right {
content: "last: " string(heading, last);
}
}
h2 { string-set: heading content() }
</pre>
<p>The following figures show the first, start, and last assignments of the “heading” string on various pages.</p>
<figure>
<img alt="" src=images/using-strings-1.jpg width=480>
<figcaption>The <a href=#string-start>start</a> value is empty, as the string had not yet been set at the start of the page.</figcaption>
</figure>
<figure>
<img alt="" src=images/using-strings-2.jpg width=480>
<figcaption>Since the page starts with an h2, the <a href=#string-start>start</a> value is the value of that head.</figcaption>
</figure>
<figure>
<img alt="" src=images/using-strings-3.jpg width=480>
<figcaption>Since there’s not an h2 at the top of this page, the <a href=#string-start>start</a> value is the <span class=css>exit value</span> of the previous page.</figcaption>
</figure>
</div>
<div class=example>
<p>The following example captures the contents of H1 elements, which represent chapter names in this hypothetical document.</p>
<pre>H1 { string-set: chapter contents; }</pre>
<p>When an H1 element is encountered, the <span class=css>chapter</span> string is set to the element’s textual contents, and the previous value of <span class=css>chapter</span>, if any, is overwritten.</p>
</div>
<h3 class="heading settled" data-level=6.3 id=at-counter-styles><span class=secno>6.3. </span><span class=content>'@counter-styles'</span><a class=self-link href=#at-counter-styles></a></h3>
<p class=issue id=issue-3274bcaa><a class=self-link href=#issue-3274bcaa></a>Replaced by <a data-biblio-type=informative data-link-type=biblio href=#biblio-css-counter-styles-3 title=CSS-COUNTER-STYLES-3>[CSS-COUNTER-STYLES-3]</a></p>
<p></p>
<p></p>
<h2 class="heading settled" data-level=7 id=leaders><span class=secno>7. </span><span class=content>
Leaders
</span><a class=self-link href=#leaders></a></h2>
A leader, sometimes known as a tab leader or a dot leader, is a repeating pattern used to visually connect content across horizontal spaces. They are most commonly used in tables of contents, between titles and page numbers. The <a class=css data-link-type=maybe href=#funcdef-leader title=leader()>leader()</a> function, as a value for the content property, is used to create leaders in CSS. This function takes a string (the leader string), which describes the repeating pattern for the leader.
<table class="definition propdef partial"><tr><th>Name:<td><a class=css data-link-type=property href=#propdef-content title=content>content</a><tr><th>New values:<td class=prod>leader()<tr><th>Media:<td>paged</table>
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-leader>leader()<a class=self-link href=#funcdef-leader></a></dfn> = leader( [dotted <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> solid <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> space] <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a>);
</pre>
<p>Three keywords are shorthand values for common strings:</p>
<dl>
<dt id=dotted-leader><a class=self-link href=#dotted-leader></a>dotted</dt>
<dd>leader(". ")</dd>
<dt id=solid-leader><a class=self-link href=#solid-leader></a>solid</dt>
<dd>leader("_")</dd>
<dt id=space-leader><a class=self-link href=#space-leader></a>space</dt>
<dd>leader(" ")</dd>
<dt id=string-leader><a class=self-link href=#string-leader></a><string></dt>
<dd></dd>
</dl>
<div class=example>
<pre>
ol.toc a::after {
content: leader('.') target-counter(attr(href), page);
}
<h1>Table of Contents</h1>
<ol class="toc">
<li><a href="#chapter1">Loomings</a></li>
<li><a href="#chapter2">The Carpet-Bag</a></li>
<li><a href="#chapter3">The Spouter-Inn</a></li>
</ol>
</pre> This might result in: <pre>Table of Contents
1. Loomings.....................1
2. The Carpet-Bag...............9
3. The Spouter-Inn.............13
</pre>
</div>
<p class=issue id=issue-2f5c8d3f><a class=self-link href=#issue-2f5c8d3f></a>
Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?
</p>
<h3 class="heading settled" data-level=7.1 id=rendering-leaders><span class=secno>7.1. </span><span class=content>
Rendering leaders
</span><a class=self-link href=#rendering-leaders></a></h3>
Consider a line which contains the content before the leader (the “before content”), the leader, and the content after the leader (the “after content”). Leaders obey the following rules:
<ol>
<li>The leader string must appear in full at least once. </li>
<li>The leader should be as long as possible</li>
<li>Visible characters in leaders should vertically align with each other when possible.</li>
<li>Line break characters in the leader string must be ignored.</li>
<li>White space in the leader string follows normal CSS rules.</li>
<li>A leader only appears between the start content and the end content.</li>
<li>A leader only appears on a single line, even if the before content and after content are on different lines. </li>
<li>A leader can’t be the only thing on a line. </li>
</ol>
<h4 class="heading settled" data-level=7.1.1 id=procedure-leader><span class=secno>7.1.1. </span><span class=content>
Procedure for rendering leaders
</span><a class=self-link href=#procedure-leader></a></h4>
<ol>
<li> Lay out the before content, until reaching the line where the before content ends. <pre>BBBBBBBBBB
BBB
</pre> </li>
<li> The leader string consists of one or more glyphs, and is thus an inline box. A leader is a row of these boxes, drawn from the end edge to the start edge, where only those boxes not overlaid by the before or after content. On this line, draw the leader string, starting from the end edge, repeating as many times as possible until reaching the start edge. <pre>BBBBBBBBBB
..........
</pre> </li>
<li> Draw the before and after content on top of the leader. If any part of the before or after content overlaps a glyph in a leader string box, that glyph is not displayed.<pre>BBBBBBBBBB
BBB....AAA
</pre> </li>
<li> If one full copy of the leader string is not visible: <pre>BBBBBBB
BBBBBBA
</pre> Insert a line break before the after content, draw the leader on the next line, and draw the end content on top <pre>BBBBBBB
BBBBBB
......A
</pre> </li>
</ol>
<figure>
<img alt="drawing leaders" src=images/leader.001.jpg width=480>
<figcaption>Procedure for drawing leaders</figcaption>
</figure>
<figure>
<img alt="drawing leaders" src=images/leader.002.jpg width=480>
<figcaption>Procedure for drawing leaders when the content doesn’t fit on a single line</figcaption>
</figure>
<h2 class="heading settled" data-level=8 id=cross-references><span class=secno>8. </span><span class=content>
Cross-references
</span><a class=self-link href=#cross-references></a></h2>
Many documents contain internal references:
<ul>
<li> See chapter 7 </li>
<li> in section 4.1 </li>
<li> on page 23 </li>
</ul>
Three new values for the content property are used to automatically create these types of cross-references: <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a>, <a class=css data-link-type=maybe href=#funcdef-target-counters title=target-counters()>target-counters()</a>, and <a class=css data-link-type=maybe href=#target-text-function title=target-text()>target-text()</a>. Each of these displays information obtained from the target end of a link.
<h3 class="heading settled" data-level=8.1 id=target-counter><span class=secno>8.1. </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a> function
</span><a class=self-link href=#target-counter></a></h3>
The <a class=css data-link-type=maybe href=#funcdef-target-counter title=target-counter()>target-counter()</a> function retrieves the value of the innermost counter with a given name. The required arguments are the url of the target and the name of the counter. An optional counter-style argument can be used to format the result.
<p class=note role=note>These functions only take a fragment URL which points to a location in the current document. If there’s no fragment, if the ID referenced isn’t there, or if the URL points to an outside document, the user agent must treat that as an error.</p>
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-target-counter>target-counter()<a class=self-link href=#funcdef-target-counter></a></dfn> = target-counter( <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> [ <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style title="<counter-style>"><counter-style></a> ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a> )
</pre>
<div class=example>
HTML:
<pre>…which will be discussed on page <a href="#chapter4_sec2"></a>.
</pre>
<p>CSS:</p>
<pre>a::after { content: target-counter(attr(href url), page) }
</pre>
<p>Result:</p>
<pre>…which will be discussed on page 137.
</pre>
</div>
<div class=example>
Page numbers in tables of contents can be generated automatically:
<p>HTML:</p>
<pre><nav>
<ol>
<li class="frontmatter"><a href="#pref_01">Preface</a></li>
<li class="frontmatter"><a href="#intr_01">Introduction</a></li>
<li class="bodymatter"><a href="#chap_01">Chapter One</a></li>
</ol>
</nav>
</pre>
<p>CSS:</p>
<pre>.frontmatter a::after { content: leader('.') target-counter(attr(href url), page, lower-roman) }
.bodymatter a::after { content: leader('.') target-counter(attr(href url), page, decimal) }
</pre>
<p>Result:</p>
<pre>Preface.............vii
Introduction.........xi
Chapter One...........1
</pre>
</div>
<h3 class="heading settled" data-level=8.2 id=target-counters><span class=secno>8.2. </span><span class=content>
The <a class=css data-link-type=maybe href=#funcdef-target-counters title=target-counters()>target-counters()</a> function
</span><a class=self-link href=#target-counters></a></h3>
This functions fetches the value of all counters of a given name from the end of a link, and formats them by inserting a given string between the value of each nested counter.
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-target-counters>target-counters()<a class=self-link href=#funcdef-target-counters></a></dfn> = target-counter( <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#identifier-value title="<custom-ident>"><custom-ident></a> <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value title="<string>"><string></a> [ <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style title="<counter-style>"><counter-style></a> ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a> )
</pre>
<div class=example>
<pre>I have not found a compelling example for target-counters() yet.
</pre>
</div>
<h3 class="heading settled" data-level=8.3 id=target-text><span class=secno>8.3. </span><span class=content>
target-text
</span><a class=self-link href=#target-text></a></h3>
The <a class=css data-link-type=maybe href=#target-text-function title=target-text()>target-text()</a> function retrieves the text value of the element referred to by the URL. An optional second argument specifies what content is retrieved, using the same values as the <a class=property data-link-type=propdesc href=#propdef-string-set title=string-set>string-set</a> property above.
<pre class=prod><dfn data-dfn-type=function data-export="" id=target-text-function>target-text()<a class=self-link href=#target-text-function></a></dfn> = target-counter( <a class=production data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#url-value title="<url>"><url></a> [ <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-comma title=,>,</a> [ content <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> before <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> after <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> first-letter] ]<a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a> )
</pre>
<p class=issue id=issue-a82075c9><a class=self-link href=#issue-a82075c9></a>A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html</p>
<div class=example>
<pre>…which will be discussed <a href="#chapter_h1_1">later</a>.
a::after { content: ", in the chapter entitled " target-text(attr(href url)) }
</pre> Result: …which will be discussed later, in the chapter entitled Loomings. </div>
<h2 class="heading settled" data-level=9 id=bookmarks><span class=secno>9. </span><span class=content>
Bookmarks
</span><a class=self-link href=#bookmarks></a></h2>
Some document formats, most notably PDF, allow the use of <dfn data-dfn-type=dfn data-noexport="" id=bookmarks0>bookmarks<a class=self-link href=#bookmarks0></a></dfn> as an aid to navigation. Bookmarks provide a hierarchy of links to document elements, as well as text to label the links. A bookmark has three properties: <a class=property data-link-type=propdesc href=#propdef-bookmark-level title=bookmark-level>bookmark-level</a>, <a class=property data-link-type=propdesc href=#propdef-bookmark-label title=bookmark-label>bookmark-label</a>, and <a class=property data-link-type=propdesc href=#propdef-bookmark-state title=bookmark-state>bookmark-state</a>.
<p>A bookmark references a point in the document, which we define to the be the intersection of the before edge and the start edge of the first box or box fragment generated by the element. When a user activates a bookmark, the user agent must bring that reference point to the user’s attention, by moving to that page, scrolling (as defined in CSSOM View), or some other mechanism.</p>
<h3 class="heading settled" data-level=9.1 id=bookmark-level><span class=secno>9.1. </span><span class=content>
bookmark-level
</span><a class=self-link href=#bookmark-level></a></h3>
<p>The <a class=property data-link-type=propdesc href=#propdef-bookmark-level title=bookmark-level>bookmark-level</a> property determines if a bookmark is created, and at what level. If this property is absent, or has value <span class=css>none</span>, no bookmark should be generated, regardless of the values of <a class=property data-link-type=propdesc href=#propdef-bookmark-label title=bookmark-label>bookmark-label</a> or <a class=property data-link-type=propdesc href=#propdef-bookmark-state title=bookmark-state>bookmark-state</a>.</p>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-bookmark-level>bookmark-level<a class=self-link href=#propdef-bookmark-level></a></dfn><tr><th>Value:<td class=prod>none <a data-link-for="" data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <integer><tr><th>Initial:<td>none<tr><th>Applies to:<td>all elements<tr><th>Inherited:<td>no<tr><th>Percentages:<td>N/A<tr><th>Media:<td>visual<tr><th>Computed value:<td>specified value<tr><th>Animatable:<td>no</table>
<dl data-dfn-for=bookmark-level data-dfn-type=value>
<dt><integer></dt>
<dd>defines the level of the bookmark, with the highest level being 1 (negative and zero values are invalid). </dd>
<dt>none</dt>
<dd>no bookmark is generated.</dd>
</dl>
<div class=example>
<pre>section h1 { bookmark-level: 1; }
section section h1 { bookmark-level: 2; }
section section section h1 { bookmark-level: 3; }
</pre>
</div>
<h3 class="heading settled" data-level=9.2 id=bookmark-label><span class=secno>9.2. </span><span class=content>
bookmark-label
</span><a class=self-link href=#bookmark-label></a></h3>