-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathgenerate.html
1233 lines (1011 loc) · 53.3 KB
/
generate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>Generated content, automatic numbering, and lists</title>
<link rel="stylesheet" href="style/default.css" type="text/css">
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2016/W3C-ED.css" type="text/css">
<link rel="prev" href="visufx.html">
<link rel="next" href="page.html">
<link rel="contents" href="cover.html#minitoc">
<link rel="CSS-properties" href="propidx.html" title="properties">
<link rel="index" href="indexlist.html" title="index">
<link rel="first" href="cover.html">
<script type="text/javascript" src="//www.w3.org/scripts/TR/2016/fixup.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="navbar">
<p><a href="visufx.html">previous</a>
<a href="page.html">next</a>
<a href="cover.html#minitoc">contents</a>
<a href="propidx.html">properties</a>
<a href="indexlist.html">index</a>
</div>
<hr class="navbar">
<h1>12
<a name="generated-text">Generated</a> <a name="x0"><span class="index-def"
title="generated content">content</span></a>, automatic <a name="x1"><span
class="index-def" title="automatic numbering">numbering</span></a>,
and lists</h1>
<div id="toc" class="subtoc">
<p><strong>Contents</strong>
<ul class="toc">
<li><a href="generate.html#before-after-content" class="tocxref">12.1 The <span class="index-def" title=":before|pseudo-elements:::before|before">:before</span> and <span class="index-def" title=":after|pseudo-elements:::after|after">:after</span> pseudo-elements</a>
<li><a href="generate.html#content" class="tocxref">12.2 The <span class="propinst-content">'content'</span> property</a>
<li><a href="generate.html#quotes" class="tocxref">12.3 Quotation marks</a>
<ul class="toc">
<li><a href="generate.html#quotes-specify" class="tocxref">12.3.1 Specifying quotes with the <span class="propinst-quotes">'quotes'</span> property</a>
<li><a href="generate.html#quotes-insert" class="tocxref">12.3.2 Inserting quotes with the <span class="propinst-content">'content'</span> property</a>
</ul>
<li><a href="generate.html#counters" class="tocxref">12.4 Automatic <span class="index-def" title="counters">counters</span> and numbering</a>
<ul class="toc">
<li><a href="generate.html#scope" class="tocxref">12.4.1 Nested counters and scope</a>
<li><a href="generate.html#counter-styles" class="tocxref">12.4.2 Counter styles</a>
<li><a href="generate.html#undisplayed-counters" class="tocxref">12.4.3 Counters in elements with 'display: none'</a>
</ul>
<li><a href="generate.html#lists" class="tocxref">12.5 Lists</a>
<ul class="toc">
<li><a href="generate.html#list-style" class="tocxref">12.5.1 Lists: the <span class="propinst-list-style-type">'list-style-type'</span>, <span class="propinst-list-style-image">'list-style-image'</span>, <span class="propinst-list-style-position">'list-style-position'</span>, and <span class="propinst-list-style">'list-style'</span> properties</a>
</ul>
</ul>
</div>
<p>In some cases, authors may want user agents to render content
that does not come from the <a href="conform.html#doctree">document
tree</a>. One familiar example of this is a numbered list; the author
does not want to list the numbers explicitly, he or she wants the
user agent to generate them automatically. Similarly, authors
may want the user agent to insert the word
"Figure" before the caption of a figure, or "Chapter 7" before the
seventh chapter title. For audio or braille in particular, user agents
should be able to insert these strings.
<p>In CSS 2.2, content may be generated by two mechanisms:</p>
<ul>
<li>The <a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a>
property, in conjunction with the :before and :after pseudo-elements.
<li>Elements with a value of 'list-item'
for the <a href="visuren.html#propdef-display" class="noxref"><span class="propinst-display">'display'</span></a> property.
</ul>
<h2>12.1 <a name="before-after-content">The</a> <a name="x2"><span class="index-def"
title=":before|pseudo-elements:::before|before">:before</span></a> and <a name="x5"><span
class="index-def" title=":after|pseudo-elements:::after|after">:after</span></a>
pseudo-elements</h2>
<p>Authors specify the style and location of generated content with
the :before and :after pseudo-elements. As their names indicate, the
:before and :after pseudo-elements specify the location of content
before and after an element's <a href="conform.html#doctree">document
tree</a> content. The <a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a>
property, in conjunction with these pseudo-elements, specifies what is
inserted.
<div class=example><P style="display:none">Example(s):</P>
<p>For example, the following rule inserts the string "Note: "
before the content of
every P element whose "class" attribute has the value "note":</p>
<pre>
p.note:before { content: "Note: " }
</pre>
</div>
<P>The formatting objects (e.g., boxes) generated by an element include
generated content. So, for example, changing the above style sheet
to:</p>
<pre class="example">
p.note:before { content: "Note: " }
p.note { border: solid green }
</pre>
<P>would cause a solid green border to be rendered around the entire
paragraph, including the initial string.
<P>The :before and :after pseudo-elements <a
href="cascade.html#inheritance">inherit</a> any inheritable properties
from the element in the document tree to which they are attached.</p>
<div class=example><P style="display:none">Example(s):</P>
<p>For example, the following rules insert an open quote mark before every
Q element. The color of the quote mark will be red, but the font will
be the same as the font of the rest of the Q element:</p>
<pre>
q:before {
content: open-quote;
color: red
}
</pre>
</div>
<p>In a :before or :after pseudo-element declaration, non-inherited
properties take their <a href="about.html#initial-value">initial
values</a>.</p>
<div class=example><P style="display:none">Example(s):</P>
<p>So, for example, because the initial value of the <a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> property is 'inline', the
quote in the previous example is inserted as an inline box (i.e.,
on the same line as the element's initial text content).
The next example explicitly sets the
<a href="visuren.html#propdef-display" class="noxref"><span class="propinst-display">'display'</span></a> property to
'block', so that the inserted text becomes a block:</p>
<pre>
body:after {
content: "The End";
display: block;
margin-top: 2em;
text-align: center;
}
</pre>
</div>
<p>The :before and :after pseudo-elements interact with other
boxes as if they were real elements inserted just
inside their associated element.</p>
<div class="example"><P style="display:none">Example(s):</P>
<p>For example, the following document fragment and style sheet:</p>
<pre>
<p> Text </p> p:before { display: block; content: 'Some'; }
</pre>
<p>...would render in exactly the same way as the following document
fragment and style sheet:</p>
<pre>
<p><span>Some</span> Text </p> span { display: block }
</pre>
<p>Similarly, the following document fragment and style sheet:</p>
<pre>
<h2> Header </h2> h2:after { display: block; content: 'Thing'; }
</pre>
<p>...would render in exactly the same way as the following document
fragment and style sheet:</p>
<pre>
<h2> Header <span>Thing</span></h2> h2 { display: block; }
span { display: block; }
</pre>
</div>
<div class="note">
<p><strong>Note.</strong> This specification does not fully define the interaction of :before
and :after with replaced elements (such as IMG in HTML). This will
be defined in more detail in a future specification.</p>
</div>
<h2>12.2 <a name="content">The</a> <a href="generate.html#propdef-content" class="noxref"><span
class="propinst-content">'content'</span></a> property</h2>
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x8"><span class="index-def" title="'content'"><dfn id="propdef-content">content</dfn></span></a><tr><th>Value:<td>normal | none | [ <a href="syndata.html#value-def-string" class="noxref"><span class="value-inst-string"><string></span></a> | <a href="syndata.html#value-def-uri" class="noxref"><span class="value-inst-uri"><uri></span></a> | <a href="syndata.html#value-def-counter" class="noxref"><span class="value-inst-counter"><counter></span></a> | attr(<a href="syndata.html#value-def-identifier" class="noxref"><span class="value-inst-identifier"><identifier></span></a>) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr><th>Initial:<td>normal
<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><a href="media.html#all-media-group" class="noxref">all</a>
<tr><th>Computed value:<td>On elements, always computes to 'normal'. On :before and :after, if
'normal' is specified, computes to 'none'. Otherwise, for URI
values, the absolute URI; for attr() values, the resulting string;
for other keywords, as specified.
</table>
<p>This property is used with the :before and :after pseudo-elements
to generate content in a document. Values have the following
meanings:</p>
<dl>
<dt><a name="x9"><span class="index-inst" title="none"><strong>none</strong></span></a>
<dd>The pseudo-element is not generated.</dd>
<dt><a name="x10"><span class="index-inst" title="normal"><strong>normal</strong></span></a>
<dd>Computes to 'none' for the :before and :after pseudo-elements.</dd>
<dt><span class="index-inst" title="<string>"><a name="x11" href="syndata.html#value-def-string" class="noxref"><span
class="value-inst-string"><strong><string></strong></span></a></span>
<dd>Text content
(see the section on <a href="syndata.html#strings">strings</a>).
<dt><span class="index-inst" title="<uri>"><a name="x12" href="syndata.html#value-def-uri" class="noxref"><span
class="value-inst-uri"><strong><uri></strong></span></a></span>
<dd>The value is a URI that designates an external resource (such as an image).
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.
<dt><span class="index-inst" title="<counter>"><a name="x13" href="syndata.html#value-def-counter" class="noxref"><span
class="value-inst-counter"><strong><counter></strong></span></a></span>
<dd><a href="syndata.html#counter">Counters</a> may be specified
with two different functions: 'counter()' or 'counters()'.
The former has two forms:
'counter(<var>name</var>)' or 'counter(<var>name</var>,
<var>style</var>)'.
The generated text is the value of the innermost counter of the given
name in scope at this pseudo-element; it is formatted in the indicated
<a href="#counter-styles">style</a> ('decimal' by default). The latter
function also has two forms: 'counters(<var>name</var>,
<var>string</var>)' or 'counters(<var>name</var>, <var>string</var>,
<var>style</var>)'. The generated text is the value of all counters
with the given name in scope at this pseudo-element, from outermost to
innermost separated by the specified string. The counters are rendered
in the indicated <a href="#counter-styles">style</a> ('decimal' by
default). See the section on <a href="#counters">automatic counters
and numbering</a> for more information.
The name must not be 'none', 'inherit' or 'initial'. Such a name
causes the declaration to be ignored.
<dt><span class="index-inst"
title="open-quote"><a name="x14" href="generate.html#value-def-open-quote" class="noxref"><span
class="value-inst-open-quote"><strong>open-quote</strong></span></a></span>
and <span class="index-inst" title="close-quote"><a name="x15" href="generate.html#value-def-close-quote" class="noxref"><span
class="value-inst-close-quote"><strong>close-quote</strong></span></a></span>
<dd>These values are replaced by the appropriate string
from the <a href="generate.html#propdef-quotes" class="noxref"><span class="propinst-quotes"><strong>'quotes'</strong></span></a> property.
<dt><span class="index-inst" title="no-open-quote"><a name="x16" href="generate.html#value-def-no-open-quote" class="noxref"><span
class="value-inst-no-open-quote"><strong>no-open-quote</strong></span></a></span>
and <span class="index-inst" title="no-close-quote"><a name="x17" href="generate.html#value-def-no-close-quote" class="noxref"><span
class="value-inst-no-close-quote"><strong>no-close-quote</strong></span></a></span>
<dd>Introduces no content, but increments (decrements) the level of nesting for quotes.
<dt><a name="x18"><span class="index-def" title="attr()"><strong>attr(X)</strong></span></a>
<dd>This function returns as a string the value of attribute X
for the subject of the selector. The
string is not parsed by the CSS processor. If the subject of the selector
does not have an attribute X, an empty string is returned. The
case-sensitivity of attribute names depends on the document language.
</dl>
<div class="note">
<strong>Note.</strong> In CSS 2.2, it is not possible to refer to
attribute values for other elements than the subject of the selector.
</div>
<P>The <a href="visuren.html#propdef-display" class="noxref"><span class="propinst-display">'display'</span></a> property
controls whether the content is placed in a block or inline box.
<div class="example"><P style="display:none">Example(s):</P><p>The following rule causes the string "Chapter: " to be generated before each H1 element:</p>
<pre>
H1:before {
content: "Chapter: ";
display: inline;
}
</pre>
</div>
<p>Authors may include newlines in the generated content by writing
the "\A" escape sequence in one of the strings after the <a href="generate.html#propdef-content" class="noxref"><span
class="propinst-content">'content'</span></a> property. This inserted line
break is still subject to the <a href="text.html#propdef-white-space" class="noxref"><span
class="propinst-white-space">'white-space'</span></a> property. See <a
href="syndata.html#strings">"Strings"</a> and <a
href="syndata.html#escaped-characters">"Characters and case"</a> for
more information on the "\A" escape sequence.
<div class="example"><P style="display:none">Example(s):</P><P>
<PRE>
h1:before {
display: block;
text-align: center;
white-space: pre;
content: "chapter\A hoofdstuk\A chapitre"
}
</pre>
</div>
<P>Generated content does not alter the document tree. In particular, it
is not fed back to the document language processor (e.g., for
reparsing).
<h2>12.3 <a name="quotes">Quotation marks</a></h2>
<P>In CSS 2.2, authors may specify, in a style-sensitive and
context-dependent manner, how user agents should render quotation
marks. The <a href="generate.html#propdef-quotes" class="noxref"><span class="propinst-quotes">'quotes'</span></a> property
specifies pairs of quotation marks for each level of embedded
quotation. The <a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a>
property gives access to those quotation marks and causes them to be
inserted before and after a quotation.
<H3>12.3.1 <a name="quotes-specify">Specifying quotes</a> with the <a href="generate.html#propdef-quotes" class="noxref"><span
class="propinst-quotes">'quotes'</span></a> property</H3>
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x19"><span class="index-def" title="'quotes'"><dfn id="propdef-quotes">quotes</dfn></span></a><tr><th>Value:<td>[<a href="syndata.html#value-def-string" class="noxref"><span class="value-inst-string"><string></span></a> <a href="syndata.html#value-def-string" class="noxref"><span class="value-inst-string"><string></span></a>]+ | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<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><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr><th>Computed value:<td>as specified
</table>
<P>This property specifies quotation marks for any number of embedded
quotations. Values have the following meanings:</p>
<dl>
<dt><strong>none</strong>
<dd>The 'open-quote' and 'close-quote' values of the
<a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a> property
produce no quotation marks.
<dt>[<span class="index-inst" title="<string>"><a name="x20" href="syndata.html#value-def-string" class="noxref"><span
class="value-inst-string"><strong><string></strong></span></a></span>
<span class="index-inst" title="<string>"><a name="x21" href="syndata.html#value-def-string" class="noxref"><span
class="value-inst-string"><strong><string></strong></span></a></span>]+
<dd>Values for the 'open-quote' and 'close-quote' values of the
<a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></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.
</dl>
<div class="example"><P style="display:none">Example(s):</P>
<P>For example, applying the following style sheet:</p>
<PRE class="example">
/* Specify pairs of quotes for two levels in two languages */
q:lang(en) { quotes: '"' '"' "'" "'" }
q:lang(no) { 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>
</BODY>
</HTML>
</PRE>
<P>would allow a user agent to produce:</p>
<PRE class="ascii-art">
"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>
</BODY>
</HTML>
</PRE>
<P>would produce:</p>
<PRE class="ascii-art">
«Trøndere gråter når "Vinsjan på kaia" blir deklamert.»
</PRE>
</div>
<div class="note"><P>
<em><strong>Note.</strong>
While the quotation marks specified by <a href="generate.html#propdef-quotes" class="noxref"><span
class="propinst-quotes">'quotes'</span></a> in the previous examples are
conveniently located on computer keyboards, high quality typesetting
would require different ISO 10646 characters. The following
informative table lists some of the ISO 10646 quotation
mark characters:</em></p>
<TABLE border>
<TR><TH>Character</TH><TH>Approximate rendering<TH>ISO 10646 code (hex)<TH>Description
<TR><TD>"<TD>"<TD>0022<TD>QUOTATION MARK [the ASCII double quotation mark]
<TR><TD>'<TD>'<TD>0027<TD>APOSTROPHE [the ASCII single quotation mark]
<TR><TD>‹<TD><<TD>2039<TD>SINGLE LEFT-POINTING ANGLE QUOTATION MARK
<TR><TD>›<TD>><TD>203A<TD>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
<TR><TD>«<TD>«<TD>00AB<TD>LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
<TR><TD>»<TD>»<TD>00BB<TD>RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
<TR><TD>‘<TD>`<TD>2018<TD>LEFT SINGLE QUOTATION MARK [single high-6]
<TR><TD>’<TD>'<TD>2019<TD>RIGHT SINGLE QUOTATION MARK [single high-9]
<TR><TD>“<TD>``<TD>201C<TD>LEFT DOUBLE QUOTATION MARK [double high-6]
<TR><TD>”<TD>''<TD>201D<TD>RIGHT DOUBLE QUOTATION MARK [double high-9]
<TR><TD>„<TD>,,<TD>201E<TD>DOUBLE LOW-9 QUOTATION MARK [double low-9]
</TABLE>
</div>
<H3>12.3.2 <a name="quotes-insert">Inserting quotes</a> with the <a href="generate.html#propdef-content" class="noxref"><span
class="propinst-content">'content'</span></a> property</H3>
<p>Quotation marks are inserted in appropriate places in a document
with the <span class="index-def" title="open-quote"><a
class="value-def" name="value-def-open-quote">'open-quote'</a></span>
and <span class="index-def" title="close-quote"><a class="value-def"
name="value-def-close-quote">'close-quote'</a></span> values of the
<a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a> property. Each
occurrence of 'open-quote' or 'close-quote' is replaced by one of the
strings from the value of <a href="generate.html#propdef-quotes" class="noxref"><span
class="propinst-quotes">'quotes'</span></a>, based on the depth of
nesting.
<p>'Open-quote' refers to the first of a pair of quotes, 'close-quote'
refers to the second. Which pair of quotes is used depends on the
nesting level of quotes: the number of occurrences of 'open-quote' in
all generated text before the current occurrence, minus the number of
occurrences of 'close-quote'. 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. A 'close-quote'
or 'no-close-quote' that would make the depth negative is in error and is
ignored (at rendering time): the depth stays at 0 and no quote mark is
rendered (although the rest of the 'content' property's value is still
inserted).
<div class="note"><p>
<em><strong>Note.</strong> The quoting depth is independent of the nesting
of the source document or the formatting structure.</em>
</p></div>
<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="index-def" title="no-close-quote"><a
class="value-def"
name="value-def-no-close-quote">'no-close-quote'</a></span> decrements
the quoting level, but does not insert a quotation mark.
<div class="example"><P style="display:none">Example(s):</P>
<p>The following style sheet puts opening quotation marks on every
paragraph in a BLOCKQUOTE, 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:after { content: close-quote }
</pre>
<P>This relies on the last paragraph being marked with a class "last".
</div>
<p>For symmetry, there is also a <span class="index-def"
title="no-open-quote"><a class="value-def"
name="value-def-no-open-quote">'no-open-quote'</a></span> keyword,
which inserts nothing, but increments the quotation depth by one.
<h2>12.4 Automatic <span class="index-def" title="counters"><a
name="counters">counters</a></span> and numbering</h2>
<p>Automatic numbering in CSS 2.2 is controlled with two properties,
<a href="generate.html#propdef-counter-increment" class="noxref"><span class="propinst-counter-increment">'counter-increment'</span></a>
and <a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a>. The
counters defined by these properties are used with the counter() and
counters() functions of the the <a href="generate.html#propdef-content" class="noxref"><span
class="propinst-content">'content'</span></a> property.
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x27"><span class="index-def" title="'counter-reset'"><dfn id="propdef-counter-reset">counter-reset</dfn></span></a><tr><th>Value:<td>[ <a href="syndata.html#value-def-identifier" class="noxref"><span class="value-inst-identifier"><identifier></span></a> <a href="syndata.html#value-def-integer" class="noxref"><span class="value-inst-integer"><integer></span></a>? ]+ | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<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><a href="media.html#all-media-group" class="noxref">all</a>
<tr><th>Computed value:<td>as specified
</table>
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x28"><span class="index-def" title="'counter-increment'"><dfn id="propdef-counter-increment">counter-increment</dfn></span></a><tr><th>Value:<td>[ <a href="syndata.html#value-def-identifier" class="noxref"><span class="value-inst-identifier"><identifier></span></a> <a href="syndata.html#value-def-integer" class="noxref"><span class="value-inst-integer"><integer></span></a>? ]+ | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<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><a href="media.html#all-media-group" class="noxref">all</a>
<tr><th>Computed value:<td>as specified
</table>
<p>The <a href="generate.html#propdef-counter-increment" class="noxref"><span
class="propinst-counter-increment">'counter-increment'</span></a> property
accepts one or more names of counters (identifiers), each one
optionally followed by an integer. The integer indicates by how much the
counter is incremented for every occurrence of the element. The
default increment is 1. Zero and negative integers are allowed.
<p>The <a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a>
property also contains a list of one or more names of counters, each
one optionally followed by an integer. The integer gives the value that
the counter is set to on each occurrence of the element. The default
is 0.
<p>The keywords 'none', 'inherit' and 'initial' must not be used as
counter names. A value of 'none' on its own means no counters are
reset, resp. incremented. 'Inherit' on its own has its usual meaning
(see <a href="cascade.html#value-def-inherit">6.2.1</a>). 'Initial' is
reserved for future use.
<div class="example"><P style="display:none">Example(s):</P>
<p>This example shows a way to number chapters and sections with
"Chapter 1", "1.1", "1.2", etc.
<pre>
BODY {
counter-reset: chapter; /* Create a chapter counter scope */
}
H1:before {
content: "Chapter " counter(chapter) ". ";
counter-increment: chapter; /* Add 1 to chapter */
}
H1 {
counter-reset: section; /* Set section to 0 */
}
H2:before {
content: counter(chapter) "." counter(section) " ";
counter-increment: section;
}
</pre>
</div>
<p>If an element increments/resets a counter and also uses it (in the
<a href="generate.html#propdef-content" class="noxref"><span class="propinst-content">'content'</span></a> property of its
:before or :after pseudo-element), the counter is used <em>after</em>
being incremented/reset.
<p>If an element both resets and increments a counter, the counter is
reset first and then incremented.
<p>If the same counter is specified more than once in the value of the
<a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a> and <a href="generate.html#propdef-counter-increment" class="noxref"><span
class="propinst-counter-increment">'counter-increment'</span></a>
properties, each reset/increment of the counter is processed in the order
specified.
<div class="example"><P style="display:none">Example(s):</P>
<p>The following example will reset the 'section' counter to 0:
<pre>
H1 { counter-reset: section 2 section }
</pre>
<p>The following example will increment the 'chapter' counter by 3:
<pre>
H1 { counter-increment: chapter chapter 2 }
</pre>
</div>
<P>The <a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a>
property follows the cascading rules. Thus, due to cascading, the
following style sheet:</p>
<pre class="example">
H1 { counter-reset: section -1 }
H1 { counter-reset: imagenum 99 }
</pre>
<p>will only reset 'imagenum'. To reset both counters, they have to be
specified together:</p>
<pre class="example">
H1 { counter-reset: section -1 imagenum 99 }
</pre>
<h3>12.4.1 <a name="scope">Nested counters and scope</a></h3>
<p>Counters are "self-nesting", in the sense that resetting a counter
in a descendant element or pseudo-element automatically creates a new
instance of the counter. This is important for situations like lists
in HTML, where elements can be nested inside themselves to arbitrary
depth. It would be impossible to define uniquely named counters for
each level.
<div class="example"><P style="display:none">Example(s):</P>
<p>Thus, the following suffices to number nested list items. The
result is very similar to that of setting 'display:list-item' and
'list-style: inside' on the LI element:
<pre>
OL { counter-reset: item }
LI { display: block }
LI:before { content: counter(item) ". "; counter-increment: item }
</pre>
</div>
<p>The <a name="x29"><span class="index-def" title="scope"><dfn>scope</dfn></span></a>
of a counter starts at the first element in the document that has a
<a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a> for that
counter and includes the element's descendants and its following
siblings with their descendants. However, it does not include any
elements in the scope of a counter with the same name created by a 'counter-reset' on a
later sibling of the element or by a later 'counter-reset' on the same
element.
<p>If <a href="generate.html#propdef-counter-increment" class="noxref"><span
class="propinst-counter-increment">'counter-increment'</span></a> or <a href="generate.html#propdef-content" class="noxref"><span
class="propinst-content">'content'</span></a> on an element or
pseudo-element refers to a counter that is not in the scope of any
<a href="generate.html#propdef-counter-reset" class="noxref"><span class="propinst-counter-reset">'counter-reset'</span></a>,
implementations should behave as though a <a href="generate.html#propdef-counter-reset" class="noxref"><span
class="propinst-counter-reset">'counter-reset'</span></a> had reset the
counter to 0 on that element or pseudo-element.
<p>In the example above, an OL will create a counter, and all children
of the OL will refer to that counter.
<div class="html example"> <p>If we denote by item[n] the
n<sup>th</sup> instance of the "item"
counter, and by "{" and "}" the beginning and end of a
scope, then the following HTML fragment will use the indicated
counters. (We assume the style sheet as given in the example above).
<pre>
<OL> <!-- {item[0]=0 -->
<LI>item</LI> <!-- item[0]++ (=1) -->
<LI>item <!-- item[0]++ (=2) -->
<OL> <!-- {item[1]=0 -->
<LI>item</LI> <!-- item[1]++ (=1) -->
<LI>item</LI> <!-- item[1]++ (=2) -->
<LI>item <!-- item[1]++ (=3) -->
<OL> <!-- {item[2]=0 -->
<LI>item</LI> <!-- item[2]++ (=1) -->
</OL> <!-- -->
<OL> <!-- }{item[2]=0 -->
<LI>item</LI> <!-- item[2]++ (=1) -->
</OL> <!-- -->
</LI> <!-- } -->
<LI>item</LI> <!-- item[1]++ (=4) -->
</OL> <!-- -->
</LI> <!-- } -->
<LI>item</LI> <!-- item[0]++ (=3) -->
<LI>item</LI> <!-- item[0]++ (=4) -->
</OL> <!-- -->
<OL> <!-- }{item[0]=0 -->
<LI>item</LI> <!-- item[0]++ (=1) -->
<LI>item</LI> <!-- item[0]++ (=2) -->
</OL> <!-- -->
</pre>
</div>
<div class="example"><P style="display:none">Example(s):</P>
<p>Another example, showing how scope works when counters are used on
elements that are not nested, is the following. This shows how the
style rules given above to number chapters and sections would apply to
the markup given.
<pre>
<!--"chapter" counter|"section" counter -->
<body> <!-- {chapter=0 | -->
<h1>About CSS</h1> <!-- chapter++ (=1) | {section=0 -->
<h2>CSS 2</h2> <!-- | section++ (=1) -->
<h2>CSS 2.2</h2> <!-- | section++ (=2) -->
<h1>Style</h1> <!-- chapter++ (=2) |}{ section=0 -->
</body> <!-- | } -->
</pre>
</div>
<p>The 'counters()' function generates a string composed of all of the
counters with the same name that are in scope, separated by a given
string.
<div class="example"><P style="display:none">Example(s):</P><P>
<P>The following style sheet numbers nested list items
as "1", "1.1", "1.1.1", etc.
<PRE>
OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }
</PRE>
</div>
<h3>12.4.2 <a name="counter-styles">Counter styles</a></h3>
<p>By default, counters are formatted with decimal numbers, but all the
styles available for the <a href="generate.html#propdef-list-style-type" class="noxref"><span
class="propinst-list-style-type">'list-style-type'</span></a> property are
also available for counters. The notation is:</P>
<pre>
counter(<var>name</var>)
</pre>
<p>for the default style, or:</p>
<pre>
counter(<var>name</var>, <<a href="generate.html#propdef-list-style-type" class="noxref"><span class="propinst-list-style-type">'list-style-type'</span></a>>)
</pre>
<p>All the styles are allowed, including 'disc', 'circle', 'square',
and 'none'.
<div class="example"><P style="display:none">Example(s):</P><P>
<pre>
H1:before { content: counter(chno, upper-latin) ". " }
H2:before { content: counter(section, upper-roman) " - " }
BLOCKQUOTE:after { content: " [" counter(bq, lower-greek) "]" }
DIV.note:before { content: counter(notecntr, disc) " " }
P:before { content: counter(p, none) }
</pre>
</div>
<h3>12.4.3 <a name="undisplayed-counters">Counters in elements with 'display: none'</a></h3>
<p>An element that is not displayed (<a href="visuren.html#propdef-display" class="noxref"><span
class="propinst-display">'display'</span></a> set to 'none') cannot
increment or reset a counter.
<div class="example"><P style="display:none">Example(s):</P>
<p>For example, with the following style sheet,
H2s with class "secret" do not increment 'count2'.
<pre>
H2.secret {counter-increment: count2; display: none}
</pre>
</div>
<p>Pseudo-elements that are not generated also cannot increment or
reset a counter.
<div class="example"><P style="display:none">Example(s):</P>
<p>For example, the following does not increment 'heading':
<pre>
h1::before {
content: normal;
counter-increment: heading;
}
</pre>
</div>
<p>Elements with <a href="visufx.html#propdef-visibility" class="noxref"><span class="propinst-visibility">'visibility'</span></a>
set to 'hidden', on the other hand, <em>do</em> increment counters.
<h2>12.5 <a name="lists">Lists</a></h2>
<P>CSS 2.2 offers basic visual formatting of lists. An element with
'display: list-item' generates a <a
href="visuren.html#principal-box">principal block box</a> for the element's
content and, depending on the values of 'list-style-type' and
'list-style-image', possibly also a marker box as a visual indication
that the
element is a list item.
<P>The <a name="x30"><span class="index-def" title="list properties"><dfn>list
properties</dfn></span></a> describe basic visual formatting of lists:
they allow style sheets to specify the marker type (image, glyph, or
number), and the marker position with respect to the principal box
(outside it or within it before content). They do not allow authors to
specify distinct style (colors, fonts, alignment, etc.) for the list
marker or adjust its position with respect to the principal box; these
may be derived from the principal box.
<P>The <a href="colors.html#background-properties">background
properties</a> apply to the principal box only; an 'outside' marker
box is transparent.
<h3>12.5.1 <a name="list-style">Lists:</a> the <a href="generate.html#propdef-list-style-type" class="noxref"><span
class="propinst-list-style-type">'list-style-type'</span></a>, <a href="generate.html#propdef-list-style-image" class="noxref"><span
class="propinst-list-style-image">'list-style-image'</span></a>, <a href="generate.html#propdef-list-style-position" class="noxref"><span
class="propinst-list-style-position">'list-style-position'</span></a>, and
<a href="generate.html#propdef-list-style" class="noxref"><span class="propinst-list-style">'list-style'</span></a> properties</h3>
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x31"><span class="index-def" title="'list-style-type'"><dfn id="propdef-list-style-type">list-style-type</dfn></span></a><tr><th>Value:<td>disc | circle | square | decimal | decimal-leading-zero |
lower-roman | upper-roman | lower-greek |
lower-latin | upper-latin | armenian | georgian |
lower-alpha | upper-alpha |
none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr><th>Initial:<td>disc
<tr><th>Applies to:<td>elements with 'display: list-item'
<tr><th>Inherited:<td>yes
<tr><th>Percentages:<td>N/A
<tr><th>Media:<td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr><th>Computed value:<td>as specified
</table>
<P> This property specifies appearance of the list item marker if
<a href="generate.html#propdef-list-style-image" class="noxref"><span class="propinst-list-style-image">'list-style-image'</span></a> has
the value 'none' or if the image pointed to by the URI cannot be
displayed. The value 'none' specifies no marker, otherwise there are
three types of marker: glyphs, numbering systems, and alphabetic
systems.
<P>Glyphs are specified with
<strong><span class="index-def" title="disc"><a class="value-def"
name="value-def-disc">disc</a></span></strong>,
<strong><span class="index-def" title="circle"><a class="value-def"
name="value-def-circle">circle</a></span></strong>, and
<strong><span class="index-def" title="square"><a class="value-def"
name="value-def-square">square</a></span></strong>. Their exact
rendering depends on the user agent.
<P>Numbering systems are specified with:</P>
<dl>
<dt><span class="index-def" title="decimal"><a class="value-def" name="value-def-decimal"><strong>decimal</strong></a></span><dd>Decimal numbers, beginning with 1.
<dt><strong><span class="index-def" title="decimal-leading-zero"><a class="value-def" name="value-def-decimal-leading-zero">decimal-leading-zero</a></span></strong>
<dd>Decimal numbers padded by initial zeros (e.g., 01, 02, 03, ..., 98, 99).
<dt><strong><span class="index-def" title="lower-roman"><a class="value-def" name="value-def-lower-roman">lower-roman</a></span></strong>
<dd>Lowercase roman numerals (i, ii, iii, iv, v, etc.).
<dt><strong><span class="index-def" title="upper-roman"><a class="value-def" name="value-def-upper-roman">upper-roman</a></span></strong>
<dd>Uppercase roman numerals (I, II, III, IV, V, etc.).
<dt><strong><span class="index-def" title="georgian"><a class="value-def" name="value-def-georgian">georgian</a></span></strong>
<dd>Traditional Georgian numbering
(an, ban, gan, ..., he, tan, in, in-an, ...).
<dt><strong><span class="index-def" title="armenian"><a class="value-def" name="value-def-armenian">armenian</a></span></strong>
<dd>Traditional uppercase Armenian numbering.
</dl>
<P>Alphabetic systems are specified with:</P>
<dl>
<dt><strong><span class="index-def" title="lower-latin"><a class="value-def" name="value-def-lower-latin">lower-latin</a></span></strong> or <strong>lower-alpha</strong>
<dd>Lowercase ascii letters (a, b, c, ... z).
<dt><strong><span class="index-def" title="upper-latin"><a class="value-def" name="value-def-upper-latin">upper-latin</a></span></strong> or <strong>upper-alpha</strong>
<dd>Uppercase ascii letters (A, B, C, ... Z).
<dt><strong><span class="index-def" title="lower-greek"><a class="value-def" name="value-def-lower-greek">lower-greek</a></span></strong>
<dd>Lowercase classical Greek
alpha, beta, gamma, ... (α, β, γ, ...)
</dl>
<P>This specification does not define how alphabetic systems wrap at
the end of the alphabet. For instance, after 26 list items,
'lower-latin' rendering is undefined. Therefore, for long lists, we
recommend that authors specify true numbers.
<p>CSS 2.2 does not define how the list numbering is reset and
incremented. This is expected to be defined in the CSS List Module
<a href="refs.html#ref-CSS3LIST" rel="biblioentry" class="noxref"><span class="informref">[CSS3LIST]</span></a>.
<div class="html example"><P>
For example, the following HTML document:
<PRE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD>
<TITLE>Lowercase latin numbering</TITLE>
<STYLE type="text/css">
ol { list-style-type: lower-roman }
</STYLE>
</HEAD>
<BODY>
<OL>
<LI> This is the first item.
<LI> This is the second item.
<LI> This is the third item.
</OL>
</BODY>
</HTML>
</PRE>
<P>might produce something like this:
<PRE>
i This is the first item.
ii This is the second item.
iii This is the third item.
</PRE>
<P>The list marker alignment (here, right justified) depends on the user agent.
</div>
<table class="def propdef">
<tbody>
<tr>
<th>Name:
<td><a name="x44"><span class="index-def" title="'list-style-image'"><dfn id="propdef-list-style-image">list-style-image</dfn></span></a><tr><th>Value:<td><a href="syndata.html#value-def-uri" class="noxref"><span class="value-inst-uri"><uri></span></a> | none | <a href="cascade.html#value-def-inherit" class="noxref"><span class="value-inst-inherit">inherit</span></a>
<tr><th>Initial:<td>none
<tr><th>Applies to:<td>elements with 'display: list-item'
<tr><th>Inherited:<td>yes
<tr><th>Percentages:<td>N/A
<tr><th>Media:<td><a href="media.html#visual-media-group" class="noxref">visual</a>
<tr><th>Computed value:<td>absolute URI or 'none'
</table>
<P> This property sets the image that will be used as the list item
marker. When the image is available, it will replace the marker set
with the <a href="generate.html#propdef-list-style-type" class="noxref"><span
class="propinst-list-style-type">'list-style-type'</span></a> marker.
<p>The size of the image is calculated from the following rules:
<ol>
<li>If the image has an intrinsic width and height, the used width and
height are the intrinsic width and height.
<li>Otherwise, if the image has an intrinsic ratio and either an
intrinsic width or an intrinsic height, the used width/height is the
same as the provided intrinsic width/height, and the used value of the
missing dimension is calculated from the provided dimension and the
ratio.
<li>Otherwise, if the image has an intrinsic ratio, the used width is
1em and the used height is calculated from this width and the
intrinsic ratio. If this would produce a height larger than 1em, then
the used height is instead set to 1em and the used width is calculated
from this height and the intrinsic ratio.
<li>Otherwise, the image's used width is its intrinsic width if it has
one, or else 1em. The image's used height is its intrinsic height if
it has one, or else 1em.
</ol>
<div class="example"><P style="display:none">Example(s):</P><P>
The following example sets the marker at the beginning of each list
item to be the image "ellipse.png".
<PRE>
ul { list-style-image: url("http://png.com/ellipse.png") }