forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
2658 lines (2267 loc) · 163 KB
/
Overview.html
File metadata and controls
2658 lines (2267 loc) · 163 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 Counter Styles Level 3</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<link href=https://www.w3.org/StyleSheets/TR/W3C-ED rel=stylesheet type=text/css>
</head>
<body class=h-entry>
<style scoped>
pre.stylesheet { white-space: pre-wrap; }
</style>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72>
</a></p>
<h1 class="p-name no-ref" id=title>CSS Counter Styles Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20130912>12 September 2013</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-counter-styles/>http://dev.w3.org/csswg/css-counter-styles/</a><dt>Latest version:<dd><a href=http://w3.org/TR/css-counter-styles-3/>http://w3.org/TR/css-counter-styles-3/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-counter-styles/>http://dev.w3.org/csswg/css-counter-styles/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2012/WD-css-counter-styles-3-20121009/ rel=previous>http://www.w3.org/TR/2012/WD-css-counter-styles-3-20121009/</a>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-counter-styles%5D%20feedback">www-style@w3.org</a>
with subject line
“<kbd>[css-counter-styles] <var>… message topic …</var></kbd>”
(<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</a>)<dt>Test Suite:<dd>None Yet<dt>Editors:
<dd class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://xanthir.com/contact/>Tab Atkins Jr.</a> (<span class="p-org org">Google</span>)<dt>Issue Tracking:<dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Counter%20Styles&resolution=---">Bugzilla</a></dl></div>
<div data-fill-with=warning></div>
<p class=copyright data-fill-with=copyright><a href=http://www.w3.org/Consortium/Legal/ipr-notice#Copyright>Copyright</a> © 2013 <a href=http://www.w3.org/><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href=http://www.csail.mit.edu/><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href=http://www.ercim.eu/><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href=http://www.keio.ac.jp/>Keio</a>, <a href=http://ev.buaa.edu.cn/>Beihang</a>), All Rights Reserved. W3C <a href=http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer>liability</a>, <a href=http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks>trademark</a> and <a href=http://www.w3.org/Consortium/Legal/copyright-documents>document use</a> rules apply.</p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled heading" id=abstract><span class=content>Abstract</span></h2>
<p class=p-summary data-fill-with=abstract>This module introduces the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule, which allows authors to define their own custom counter styles for use with CSS list-marker and generated-content counters <a data-biblio-type=informative data-link-type=biblio href=#css3list title=CSS3LIST>[CSS3LIST]</a>. It also predefines a set of common counter styles, including the ones present in CSS2 and CSS2.1.
<a href=http://www.w3.org/TR/CSS/>CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.</p>
<h2 class="no-num no-toc no-ref heading settled heading" id=status><span class=content>Status of this document</span></h2>
<div data-fill-with=status><p>
This is a public copy of the editors' draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
<p>
The (<a href=http://lists.w3.org/Archives/Public/www-style/>archived</a>) public mailing list
<a href="mailto:www-style@w3.org?Subject=%5Bcss-counter-styles%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-counter-styles” in the subject,
preferably like this:
“[css-counter-styles] <em>…summary of comment…</em>”
<p>
This document was produced by the <a href=/Style/CSS/members>CSS Working Group</a>
(part of the <a href=/Style/>Style Activity</a>).
<p>
This document was produced by a group operating under
the <a href=/Consortium/Patent-Policy-20040205/>5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href=/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=/Consortium/Patent-Policy-20040205/#def-essential>Essential Claim(s)</a>
must disclose the information in accordance with <a href=/Consortium/Patent-Policy-20040205/#sec-Disclosure>section 6 of the W3C Patent Policy</a>.</div>
<div data-fill-with=at-risk><p>The following features are at-risk, and may be dropped during the CR period:
<ul><li>the counter styles <a class=css data-link-type=maybe href=#valuedef-cjk-decimal>cjk-decimal</a>, <a class=css data-link-type=maybe href=#valuedef-hebrew>hebrew</a>, <a class=css data-link-type=maybe href=#valuedef-hiragana>hiragana</a>, <a class=css data-link-type=maybe href=#valuedef-hiragana-iroha>hiragana-iroha</a>, <a class=css data-link-type=maybe href=#valuedef-katakana>katakana</a>, <a class=css data-link-type=maybe href=#valuedef-katakana-iroha>katakana-iroha</a>, <a class=css data-link-type=maybe href=#valuedef-japanese-informal>japanese-informal</a>, <a class=css data-link-type=maybe href=#valuedef-japanese-formal>japanese-formal</a>, <a class=css data-link-type=maybe href=#valuedef-korean-hangul-formal>korean-hangul-formal</a>, <a class=css data-link-type=maybe href=#valuedef-korean-hanja-informal>korean-hanja-informal</a>, <a class=css data-link-type=maybe href=#valuedef-korean-hanja-formal>korean-hanja-formal</a>, <a class=css data-link-type=maybe href=#valuedef-simp-chinese-informal>simp-chinese-informal</a>, <a class=css data-link-type=maybe href=#valuedef-simp-chinese-formal>simp-chinese-formal</a>, <a class=css data-link-type=maybe href=#valuedef-trad-chinese-informal>trad-chinese-informal</a>, <a class=css data-link-type=maybe href=#valuedef-trad-chinese-formal>trad-chinese-formal</a>, and <a class=css data-link-type=maybe href=#valuedef-ethiopic-numeric>ethiopic-numeric</a>.</ul></div>
<h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class=content>Table of contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc><li><a href=#intro><span class=secno>1</span>
Introduction</a><li><a href=#counter-styles><span class=secno>2</span>
Counter Styles</a><li><a href=#the-counter-style-rule><span class=secno>3</span>
Defining Custom Counter Styles: the <span class=css data-link-type=maybe>@counter-style</span> rule</a><ul class=toc><li><a href=#counter-style-system><span class=secno>3.1</span>
Counter algorithms: the <span class=property data-link-type=propdesc title=system>system</span> descriptor</a><ul class=toc><li><a href=#cyclic-system><span class=secno>3.1.1</span>
Cycling Symbols: the <span class=css data-link-type=maybe>cyclic</span> system</a><li><a href=#fixed-system><span class=secno>3.1.2</span>
Exhaustible Symbols: the <span class=css data-link-type=maybe>fixed</span> system</a><li><a href=#symbolic-system><span class=secno>3.1.3</span>
Repeating Symbols: the <span class=css data-link-type=maybe>symbolic</span> system</a><li><a href=#alphabetic-system><span class=secno>3.1.4</span>
Bijective Numerals: the <span data-link-for=system data-link-type=value>alphabetic</span> system</a><li><a href=#numeric-system><span class=secno>3.1.5</span>
Positional Numerals: the <span data-link-for=system data-link-type=value>numeric</span> system</a><li><a href=#additive-system><span class=secno>3.1.6</span>
Accumulating Numerals: the <span class=css data-link-type=maybe>additive</span> system</a><li><a href=#override-system><span class=secno>3.1.7</span>
Tweaking Existing Counter Styles: the <span class=css data-link-type=maybe>override</span> system</a></ul><li><a href=#counter-style-negative><span class=secno>3.2</span>
Formatting negative values: the <span class=property data-link-type=propdesc title=negative>negative</span> descriptor</a><li><a href=#counter-style-prefix><span class=secno>3.3</span>
Symbols before the marker: the <span class=property data-link-type=propdesc title=prefix>prefix</span> descriptor</a><li><a href=#counter-style-suffix><span class=secno>3.4</span>
Symbols after the marker: the <span class=property data-link-type=propdesc title=suffix>suffix</span> descriptor</a><li><a href=#counter-style-range><span class=secno>3.5</span>
Limiting the counter scope: the <span class=property data-link-type=propdesc title=range>range</span> descriptor</a><li><a href=#counter-style-pad><span class=secno>3.6</span>
Zero-Padding and Constant-Width Representations: the <span class=property data-link-type=propdesc title=pad>pad</span> descriptor</a><li><a href=#counter-style-fallback><span class=secno>3.7</span>
Defining fallback: the <span class=property data-link-type=propdesc title=fallback>fallback</span> descriptor</a><li><a href=#counter-style-symbols><span class=secno>3.8</span>
Marker characters: the <span class=property data-link-type=propdesc title=symbols>symbols</span> and <span class=property data-link-type=propdesc title=additive-symbols>additive-symbols</span> descriptors</a><li><a href=#counter-style-speak-as><span class=secno>3.9</span>
Speech Synthesis: the <span class=property data-link-type=propdesc title=speak-as>speak-as</span> descriptor</a></ul><li><a href=#symbols-function><span class=secno>4</span>
Defining Anonymous Counter Styles: the <span class=css data-link-type=maybe>symbols()</span> function</a><li><a href=#extending-css2><span class=secno>5</span>
Extending <span class=property data-link-type=propdesc title=list-style-type>list-style-type</span>, <span class=css data-link-type=maybe>counter()</span>, and <span class=css data-link-type=maybe>counters()</span></a><li><a href=#predefined-counters><span class=secno>6</span>
Simple Predefined Counter Styles</a><ul class=toc><li><a href=#simple-numeric><span class=secno>6.1</span>
Numeric: <span class=css data-link-type=maybe>decimal</span>, <span class=css data-link-type=maybe>decimal-leading-zero</span>, <span class=css data-link-type=maybe>cjk-decimal</span>, <span class=css data-link-type=maybe>lower-roman</span>, <span class=css data-link-type=maybe>upper-roman</span>, <span class=css data-link-type=maybe>armenian</span>, <span class=css data-link-type=maybe>georgian</span>, <span class=css data-link-type=maybe>hebrew</span></a><li><a href=#simple-alphabetic><span class=secno>6.2</span>
Alphabetic: <span class=css data-link-type=maybe>lower-alpha</span>, <span class=css data-link-type=maybe>lower-latin</span>, <span class=css data-link-type=maybe>upper-alpha</span>, <span class=css data-link-type=maybe>upper-latin</span>, <span class=css data-link-type=maybe>lower-greek</span>, <span class=css data-link-type=maybe>hiragana</span>, <span class=css data-link-type=maybe>hiragana-iroha</span>, <span class=css data-link-type=maybe>katakana</span>, <span class=css data-link-type=maybe>katakana-iroha</span></a><li><a href=#simple-symbolic><span class=secno>6.3</span>
Symbolic: <span class=css data-link-type=maybe>disc</span>, <span class=css data-link-type=maybe>circle</span>, <span class=css data-link-type=maybe>square</span>, <span class=css data-link-type=maybe>disclosure-open</span>, <span class=css data-link-type=maybe>disclosure-closed</span></a></ul><li><a href=#complex-predefined-counters><span class=secno>7</span>
Complex Predefined Counter Styles</a><ul class=toc><li><a href=#complex-cjk><span class=secno>7.1</span>
Longhand East Asian Counter Styles: <span class=css data-link-type=maybe>japanese-informal</span>, <span class=css data-link-type=maybe>japanese-formal</span>, <span class=css data-link-type=maybe>korean-hangul-formal</span>, <span class=css data-link-type=maybe>korean-hanja-informal</span>, <span class=css data-link-type=maybe>korean-hanja-formal</span>, <span class=css data-link-type=maybe>simp-chinese-informal</span>, <span class=css data-link-type=maybe>simp-chinese-formal</span>, <span class=css data-link-type=maybe>trad-chinese-informal</span>, <span class=css data-link-type=maybe>trad-chinese-formal</span></a><ul class=toc><li><a href=#limited-cjk><span class=secno>7.1.1</span>
Limited-range Implementation (required)</a><li><a href=#extended-cjk><span class=secno>7.1.2</span>
Extended Implementation (optional)</a></ul><li><a href=#ethiopic-numeric-counter-style><span class=secno>7.2</span>
Ethiopic Numeric Counter Style: <span class=css data-link-type=maybe>ethiopic-numeric</span></a></ul><li><a href=#additional-predefined><span class=secno>8</span>
Additional Predefined Counter Styles</a><li><a href=#apis><span class=secno>9</span>APIs</a><ul class=toc><li><a href=#extentions-to-cssrule-interface><span class=secno>9.1</span>
Extensions to the <code>CSSRule</code> interface</a><li><a href=#the-csscounterstylerule-interface><span class=secno>9.2</span>
The <code>CSSCounterStyleRule</code> interface</a></ul><li><a href=#ua-stylesheet><span class=secno>10</span>
Sample style sheet for HTML</a><li><a href=#changes><span class=secno></span>
Changes since the Oct 2012 Working Draft</a><li><a href=#acknowledgments><span class=secno></span>
Acknowledgments</a><li><a href=#conformance><span class=secno></span>
Conformance</a><ul class=toc><li><a href=#conventions><span class=secno></span>
Document conventions</a><li><a href=#conformance-classes><span class=secno></span>
Conformance classes</a><li><a href=#partial><span class=secno></span>
Partial implementations</a><li><a href=#experimental><span class=secno></span>
Experimental implementations</a><li><a href=#testing><span class=secno></span>
Non-experimental implementations</a></ul><li><a href=#references><span class=secno></span>
References</a><ul class=toc><li><a href=#normative><span class=secno></span>
Normative References</a><li><a href=#informative><span class=secno></span>
Informative References</a></ul><li><a href=#index><span class=secno></span>
Index</a><li><a href=#property-index><span class=secno></span>
Property index</a><ul class=toc><li><a href=#counter-style-descriptors><span class=secno></span>@counter-style Descriptors</a></ul><li><a href=#issues-index><span class=secno></span>Issues Index</a></ul></div>
<h2 class="heading settled heading" data-level=1 id=intro><span class=secno>1 </span><span class=content>
Introduction</span><a class=self-link href=#intro></a></h2>
<p> CSS 1 defined a handful of useful counter styles based on the styles that HTML traditionally allowed on ordered and unordered lists.
While this was expanded slightly by CSS2.1,
it doesn’t address the needs of worldwide typography.
<p> This module introduces the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule which allows CSS to address this in an open-ended manner,
by allowing the author to define their own counter styles.
These styles can then be used in the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#list-style-type title=list-style-type>list-style-type</a> property
or in the <span class=css data-link-type=maybe>counter()</span> and <span class=css data-link-type=maybe>counters()</span> functions.
It also defines some additional predefined counter styles,
particularly ones which are common but complicated to represent with <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a>.
<h2 class="heading settled heading" data-level=2 id=counter-styles><span class=secno>2 </span><span class=content>
Counter Styles</span><a class=self-link href=#counter-styles></a></h2>
<p> A <dfn data-dfn-type=dfn data-export="" id=counter-style>counter style<a class=self-link href=#counter-style></a></dfn> defines how to convert a counter value into a string.
Counter styles are composed of:
<p> <ul>
<li>
a name,
to identify the style
<li>
an algorithm,
which transforms integer counter values into a basic string representation
<li>
a negative sign,
which is prepended or appended to the representation of a negative counter value.
<li>
a prefix,
to prepend to the representation
<li>
a suffix
to append to the representation
<li>
a range,
which limits the values that a counter style handles
<li>
a spoken form,
which describes how to read out the counter style in a speech synthesizer
<li>
and a fallback style,
to render the representation with when the counter value is outside the counter style’s range
or the counter style otherwise can’t render the counter value
</ul>
<p> When asked to <dfn data-dfn-type=dfn data-export="" id=generate-a-counter-representation title="generate a counter|generate a counter representation">generate a counter representation<a class=self-link href=#generate-a-counter-representation></a></dfn>
using a particular counter style for a particular counter value,
follow these steps:
<ol>
<li>
If the counter value is outside the <a class=property data-link-type=propdesc href=#descdef-range title=range>range</a> of the counter style,
exit this algorithm and instead <a href=#generate-a-counter-representation>generate a counter representation</a>
using the counter style’s fallback style and the same counter value.
<li>
Using the counter value and the counter algorithm for the counter style,
generate an initial representation for the counter value.
If the counter value is negative
and the counter style is <a href=#negative-capable>negative-capable</a>,
instead generate an initial representation using the absolute value of the counter value.
<li>
If the representation uses less symbols than specified in the counter style’s <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> descriptor,
prepend symbols to the representation as specified in the <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> descriptor.
<li>
If the counter value is negative
and the counter style is <a href=#negative-capable>negative-capable</a>,
wrap the representation in the counter style’s negative sign
as specified in the <a class=property data-link-type=propdesc href=#descdef-negative title=negative>negative</a> descriptor.
<li>
Return the representation.
</ol>
<p class=note> Note: the prefix and suffix don’t play a part in this algorithm.
This is intentional;
the prefix and suffix aren’t part of the string returned by the counter() or counters() functions.
Instead, the prefix and suffix are added by the algorithm that constructs the value of the <a class=css-code data-link-spec=css-ui-3 data-link-type=property href=http://dev.w3.org/csswg/css-ui-3/#content>content</a> property for the <span class=css data-link-type=maybe>::marker</span> pseudo-element.
This also implies that the prefix and suffix always come from the specified counter-style,
even if the actual representation is constructed by a fallback style.
<h2 class="heading settled heading" data-level=3 id=the-counter-style-rule><span class=secno>3 </span><span class=content>
Defining Custom Counter Styles: the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule</span><a class=self-link href=#the-counter-style-rule></a></h2>
<p> The <dfn class=css-code data-dfn-type=at-rule data-export="" id=at-ruledef-counter-style>@counter-style<a class=self-link href=#at-ruledef-counter-style></a></dfn> rule allows authors to define a custom <a href=#counter-style>counter style</a>.
The components of a <a href=#counter-style>counter style</a> are specified by descriptors in the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule.
The algorithm is specified implicitly by a combination of the <span class=css data-link-type=maybe>system</span>, <span class=css data-link-type=maybe>symbols</span>, and <span class=css data-link-type=maybe>additive-symbols</span> properties.
<p> The general form of an <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is:
<pre>@counter-style <a class="production css-code" data-link-type=type href=#typedef-counter-style-name><counter-style-name></a> { <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-declaration-list><declaration-list></a> }</pre>
<p> The <dfn class=css-code data-dfn-type=type data-export="" id=typedef-counter-style-name><counter-style-name><a class=self-link href=#typedef-counter-style-name></a></dfn> must be be a valid identifier
and must not be <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a> or <span class=css data-link-type=maybe>none</span>,
or else the rule is invalid.
(Note, however, that some names, like <span class=css data-link-type=maybe>inside</span> or <span class=css data-link-type=maybe>initial</span>,
might conflict with the existing values of properties like <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#list-style title=list-style>list-style</a>,
and thus won’t be usable there.)
<p> Counter style names are case-sensitive.
However, the names defined in this specification are ASCII lower-cased on parse
wherever they are used as counter styles, e.g.
in the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#list-style title=list-style>list-style</a> set of properties,
in the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule,
and in the <span class=css data-link-type=maybe>counter()</span> functions.
<p> Each <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule specifies a value for every counter-style descriptor,
either implicitly or explicitly.
Those not given explicit value in the rule take the initial value listed with each descriptor in this specification.
These descriptors apply solely within the context of the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule in which they are defined,
and do not apply to document language elements.
There is no notion of which elements the descriptors apply to or whether the values are inherited by child elements.
When a given descriptor occurs multiple times in a given <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule,
only the last specified value is used;
all prior values for that descriptor must be ignored.
<p> Defining a <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> makes it available to the entire document in which it is included.
If multiple <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rules are defined with the same name,
only one wins,
according to standard cascade rules.
<a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rules cascade "atomically":
if one replaces another of the same name,
it replaces it <em>entirely</em>,
rather than just replacing the specific descriptors it specifies.
<p> This at-rule conforms with the forward-compatible parsing requirement of CSS;
conformant parsers that don’t understand these rules will ignore them without error.
Any descriptors that are not recognized or implemented by a given user agent must be ignored in their entirety;
they do not make the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule invalid.
<h3 class="heading settled heading" data-level=3.1 id=counter-style-system><span class=secno>3.1 </span><span class=content>
Counter algorithms: the <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> descriptor</span><a class=self-link href=#counter-style-system></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-system>system<a class=self-link href=#descdef-system></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td>cyclic | numeric | alphabetic | symbolic | additive | <span class=nobr>[fixed <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a>?]</span> | <span class=nobr>[ override <a class="production css-code" data-link-type=type href=#typedef-counter-style-name><counter-style-name></a> ]</span><tr><th>Initial:<td>symbolic</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> descriptor specifies which algorithm will be used to construct
the counter’s representation based on the counter value. For example,
<a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a> counter styles just cycle through their symbols repeatedly,
while <a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a> counter styles interpret their symbols as digits and
build their representation accordingly. The systems are defined as follows:
<h4 class="heading settled heading" data-level=3.1.1 id=cyclic-system><span class=secno>3.1.1 </span><span class=content>
Cycling Symbols: the <a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a> system</span><a class=self-link href=#cyclic-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-cyclic>cyclic<a class=self-link href=#valuedef-cyclic></a></dfn> counter system cycles repeatedly through its provided symbols,
looping back to the beginning when it reaches the end of the list.
It can be used for simple bullets
(just provide a single <a href=#counter-symbol>counter symbol</a>),
or for cycling through multiple symbols.
The first <a href=#counter-symbol>counter symbol</a> is used as the representation of the value 1,
the second <a href=#counter-symbol>counter symbol</a> (if it exists) is used as the representation of the value 2, etc.
<p> If the system is <a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a>,
the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must contain at least one <a href=#counter-symbol>counter symbol</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is defined over all
5E37
counter values.
<div class=example>
A "triangle bullet" counter style can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=triangle>triangle<a class=self-link href=#triangle></a></dfn> {
system: cyclic;
symbols: ‣;
suffix: "";
}
</pre>
<p> It will then produce lists that look like:
<pre>‣ One
‣ Two
‣ Three
</pre> </div>
<p> If there are <var>N</var> <a href=#counter-symbol>counter symbols</a>
and a representation is being constructed for the integer <var>value</var>,
the representation is the <a href=#counter-symbol>counter symbol</a>
at index ( (<var>value</var>-1) mod <var>N</var>)
of the list of <a href=#counter-symbol>counter symbols</a> (0-indexed).
<h4 class="heading settled heading" data-level=3.1.2 id=fixed-system><span class=secno>3.1.2 </span><span class=content>
Exhaustible Symbols: the <a class=css data-link-type=maybe href=#valuedef-fixed>fixed</a> system</span><a class=self-link href=#fixed-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-fixed>fixed<a class=self-link href=#valuedef-fixed></a></dfn> counter system runs through its list of counter symbols once,
then falls back.
It is useful for representing counter styles that only have a finite number of representations.
For example, Unicode defines several limited-length runs of special characters meant for lists,
such as circled digits.
<p> If the system is <a class=css data-link-type=maybe href=#valuedef-fixed>fixed</a>,
the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must contain at least one <a href=#counter-symbol>counter symbol</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is defined over counter values in a finite range,
starting with the <a href=#first-symbol-value>first symbol value</a> and having a length equal to the length of the list of <a href=#counter-symbol>counter symbols</a>.
<p> When this system is specified,
it may optionally have an integer provided after it,
which sets the <dfn data-dfn-type=dfn data-export="" id=first-symbol-value>first symbol value<a class=self-link href=#first-symbol-value></a></dfn>.
If it is omitted, the <a href=#first-symbol-value>first symbol value</a> is 1.
<div class=example>
A "box-corner" counter style can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=box-corner>box-corner<a class=self-link href=#box-corner></a></dfn> {
system: fixed;
symbols: ◰ ◳ ◲ ◱;
suffix: ':';
}
</pre>
<p> It will then produce lists that look like:
<pre>◰: One
◳: Two
◲: Three
◱: Four
5: Five
6: Six
</pre> </div>
<p> The first <a href=#counter-symbol>counter symbol</a> is the representation for the <a href=#first-symbol-value>first symbol value</a>,
and subsequent counter values are represented by subsequent <a href=#counter-symbol>counter symbols</a>.
Once the list of <a href=#counter-symbol>counter symbols</a> is exhausted,
further values cannot be represented by this counter style,
and must instead be represented by the fallback counter style.
<h4 class="heading settled heading" data-level=3.1.3 id=symbolic-system><span class=secno>3.1.3 </span><span class=content>
Repeating Symbols: the <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a> system</span><a class=self-link href=#symbolic-system></a></h4>
<p> The <dfn class=css-code data-dfn-for='data-link-typesystem"' data-dfn-type=value data-export="" id=valuedef-symbolic>symbolic<a class=self-link href=#valuedef-symbolic></a></dfn> counter system cycles repeatedly through its provided symbols,
doubling, tripling, etc. the symbols on each successive pass through the list.
For example, if the original symbols were "*" and "†",
then on the second pass they would instead be "**" and "††",
while on the third they would be "***"and "†††", etc.
It can be used for footnote-style markers,
and is also sometimes used for alphabetic-style lists for a slightly different presentation than what the <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a> system presents.
<p> If the system is <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a>,
the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must contain at least one <a href=#counter-symbol>counter symbol</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is defined only over strictly positive counter values.
<div class=example>
An "footnote" counter style can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=footnote>footnote<a class=self-link href=#footnote></a></dfn> {
system: symbolic;
symbols: '*' ⁑ † ‡;
suffix: "";
}
</pre>
<p> It will then produce lists that look like:
<pre>* One
⁑ Two
† Three
‡ Four
** Five
⁑⁑ Six
</pre> </div>
<div class=example>
Some style guides mandate a list numbering that looks similar to <a class=css data-link-type=maybe href=#valuedef-upper-alpha>upper-alpha</a>,
but repeats differently after the first 26 values,
instead going "AA", "BB", "CC", etc.
This can be achieved with the symbolic system:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=upper-alpha-legal>upper-alpha-legal<a class=self-link href=#upper-alpha-legal></a></dfn> {
system: symbolic;
symbols: A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z;
}
</pre>
<p> This style is identical to <a class=css data-link-type=maybe href=#valuedef-upper-alpha>upper-alpha</a> through the first 27 values,
but they diverge after that, with <a class=css data-link-type=maybe href=#valuedef-upper-alpha>upper-alpha</a> going "AB", "AC", "AD", etc.
Starting at the 53rd value, <a class=css data-link-type=maybe href=#valuedef-upper-alpha>upper-alpha</a> goes "BA", "BB", "BC", etc.,
while this style jumps into triple digits with "AAA", "BBB", "CCC", etc.
</div>
<p> To construct the representation, run the following algorithm:
<p> Let <var>N</var> be the length of the list of <a href=#counter-symbol>counter symbols</a>,
<var>value</var> initially be the counter value,
<var>S</var> initially be the empty string,
and <var>symbol(n)</var> be the nth <a href=#counter-symbol>counter symbol</a> in the list of <a href=#counter-symbol>counter symbols</a> (0-indexed).
<ol>
<li>Let the <var>chosen symbol</var> be <code class=inline>symbol(<var>value</var> mod <var>N</var>)</code>.
<li>Let the <var>representation length</var> be <code class=inline>floor( (<var>value</var> - 1) / <var>N</var> )</code>.
<li>Append the <var>chosen symbol</var> to <var>S</var> a number of times equal to the <var>representation length</var>.
</ol>
<p> Finally, return <var>S</var>.
<p> The <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a> system will produce representations with sizes that are linear in the magnitude of the counter value.
This can potentially be abused to generate excessively large representations
and consume undue amounts of the user’s memory or even hang their browser.
User agents must support representations at least 20 characters long,
but they may choose to instead use the fallback style for representations that would be longer than 20 characters.
<h4 class="heading settled heading" data-level=3.1.4 id=alphabetic-system><span class=secno>3.1.4 </span><span class=content>
Bijective Numerals: the <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a> system</span><a class=self-link href=#alphabetic-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-alphabetic0>alphabetic<a class=self-link href=#valuedef-alphabetic0></a></dfn> counter system interprets the list of <a href=#counter-symbol>counter symbols</a> as digits to an <em>alphabetic</em> numbering system,
similar to the default <a class=css data-link-type=maybe href=#valuedef-lower-alpha>lower-alpha</a> counter style,
which wraps from "a", "b", "c", to "aa", "ab", "ac".
Alphabetic numbering systems do not contain a digit representing 0;
so the first value when a new digit is added is composed solely of the first digit.
Alphabetic numbering systems are commonly used for lists,
and also appear in many spreadsheet programs to number columns.
The first <a href=#counter-symbol>counter symbol</a> in the list is interpreted as the digit 1,
the second as the digit 2,
and so on.
<p> If the system is <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a>,
the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must contain at least two <a href=#counter-symbol>counter symbols</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is defined only over strictly positive counter values.
<div class=example>
A counter style using go stones can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=go>go<a class=self-link href=#go></a></dfn> {
system: alphabetic;
symbols: url(white.svg) url(black.svg);
suffix: "";
}
</pre>
<p> It will then produce lists that look like:
<div class=alphabetic-example>
<span><img alt="" src=images/white.svg></span> One<br>
<span><img alt="" src=images/black.svg></span> Two<br>
<span><img alt="" src=images/white.svg><img alt="" src=images/white.svg></span> Three<br>
<span><img alt="" src=images/white.svg><img alt="" src=images/black.svg></span> Four<br>
<span><img alt="" src=images/black.svg><img alt="" src=images/white.svg></span> Five<br>
<span><img alt="" src=images/black.svg><img alt="" src=images/black.svg></span> Six<br>
<span><img alt="" src=images/white.svg><img alt="" src=images/white.svg><img alt="" src=images/white.svg></span> Seven
</div>
<p class=note> Note: This example requires support for SVG images to display correctly.
</div>
<p> If there are <var>N</var> <a href=#counter-symbol>counter symbols</a>,
the representation is a base <var>N</var> alphabetic number using the <a href=#counter-symbol>counter symbols</a> as digits.
To construct the representation, run the following algorithm:
<p> Let <var>N</var> be the length of the list of <a href=#counter-symbol>counter symbols</a>,
<var>value</var> initially be the counter value,
<var>S</var> initially be the empty string,
and <var>symbol(n)</var> be the nth <a href=#counter-symbol>counter symbol</a> in the list of <a href=#counter-symbol>counter symbols</a> (0-indexed).
<p> While <var>value</var> is not equal to 0:
<ol>
<li>Set <var>value</var> to <code><var>value</var> - 1</code>.
<li>Prepend <var>symbol( <var>value</var> mod <var>N</var> )</var>
to <var>S</var>.
<li>Set <var>value</var> to <code>floor( <var>value</var> / <var>N</var> )</code>.
</ol>
<p> Finally, return <var>S</var>.
<h4 class="heading settled heading" data-level=3.1.5 id=numeric-system><span class=secno>3.1.5 </span><span class=content>
Positional Numerals: the <a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a> system</span><a class=self-link href=#numeric-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-numeric0>numeric<a class=self-link href=#valuedef-numeric0></a></dfn> counter system interprets the list of <a href=#counter-symbol>counter symbols</a>
as digits to a "place-value" numbering system,
similar to the default <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a> counter style.
The first <a href=#counter-symbol>counter symbol</a> in the list is interpreted as the digit 0,
the second as the digit 1,
and so on.
<p> If the system is <a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a>,
the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must contain at least two <a href=#counter-symbol>counter symbols</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is defined over all counter values.
<div class=example>
A "trinary" counter style can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=trinary>trinary<a class=self-link href=#trinary></a></dfn> {
system: numeric;
symbols: '0' '1' '2';
}
</pre>
<p> It will then produce lists that look like:
<pre>1. One
2. Two
10. Three
11. Four
12. Five
20. Six
</pre> </div>
<p> If there are <var>N</var> <a href=#counter-symbol>counter symbols</a>,
the representation is a base <var>N</var> number using the <a href=#counter-symbol>counter symbols</a> as digits.
To construct the representation, run the following algorithm:
<p> Let <var>N</var> be the length of the list of <a href=#counter-symbol>counter symbols</a>,
<var>value</var> initially be the counter value,
<var>S</var> initially be the empty string,
and <var>symbol(n)</var> be the nth <a href=#counter-symbol>counter symbol</a> in the list of <a href=#counter-symbol>counter symbols</a> (0-indexed).
<ol>
<li>If <var>value</var> is 0, append <var>symbol(0)</var> to
<var>S</var> and return <var>S</var>.
<li>While <var>value</var> is not equal to 0:
<ol>
<li>Prepend <var>symbol( <var>value</var> mod <var>N</var> )</var>
to <var>S</var>.
<li>Set <var>value</var> to <code>floor( <var>value</var> / <var>N</var> )</code>.
</ol>
<li>Return <var>S</var>.
</ol>
<h4 class="heading settled heading" data-level=3.1.6 id=additive-system><span class=secno>3.1.6 </span><span class=content>
Accumulating Numerals: the <a class=css data-link-type=maybe href=#valuedef-additive>additive</a> system</span><a class=self-link href=#additive-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-additive>additive<a class=self-link href=#valuedef-additive></a></dfn> counter system is used to represent "sign-value" numbering systems,
which, rather than using reusing digits in different positions to change their value,
define additional digits with much larger values,
so that the value of the number can be obtained by adding all the digits together.
This is used in Roman numerals
and other numbering systems around the world.
<p> If the system is <a class=css data-link-type=maybe href=#valuedef-additive>additive</a>,
the <a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptor must contain at least one <a href=#additive-tuple>additive tuple</a>,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
This system is nominally defined over all counter values
(see algorithm, below, for exact details).
<div class=example>
A "dice" counter style can be defined as:
<pre>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=dice>dice<a class=self-link href=#dice></a></dfn> {
system: additive;
additive-symbols: 6 ⚅, 5 ⚄, 4 ⚃, 3 ⚂, 2 ⚁, 1 ⚀;
suffix: "";
}
</pre>
<p> It will then produce lists that look like:
<pre>⚀ One
⚁ Two
⚂ Three
...
⚅⚄ Eleven
⚅⚅ Twelve
⚅⚅⚀ Thirteen
</pre> </div>
<p> To construct the representation, run this algorithm:
<p> Let <var>value</var> initially be the counter value,
<var>S</var> initially be the empty string,
and <var>symbol list</var> initially be the list of <a href=#additive-tuple>additive tuples</a>.
<ol>
<li>If <var>value</var> is initially 0, and there is an <a href=#additive-tuple>additive tuple</a> with a weight of 0, append that tuple’s <a href=#counter-symbol>counter symbol</a> to S and return S.
<li>While <var>value</var> is greater than 0 and there are elements left in the <var>symbol list</var>:
<ol>
<li>Pop the first <a href=#additive-tuple>additive tuple</a> from the <var>symbol list</var>.
This is the <dfn data-dfn-type=dfn data-noexport="" id=current-tuple title="current tuple|current tuple’s">current tuple<a class=self-link href=#current-tuple></a></dfn>.
&l
2258
t;li>Append the <a href=#current-tuple>current tuple</a>'s <a href=#counter-symbol>counter symbol</a> to <var>S</var>
<code>floor( <var>value</var> / <var><a href=#current-tuple>current tuple’s</a> weight</var> )</code>
times (this may be 0).
<li>Decrement <var>value</var> by the <var><a href=#current-tuple>current tuple’s</a></var> weight multiplied
by the number of times the <a href=#current-tuple>current tuple</a> was appended to <var>S</var>
in the previous step.
</ol>
<li>If the loop ended because <var>value</var> is 0, return S. Otherwise, the given counter value cannot be represented by this counter style, and must instead be represented by the fallback counter style.
</ol>
<p> The <a class=css data-link-type=maybe href=#valuedef-additive>additive</a> system will produce representations with sizes that are linear in the magnitude of the counter value.
This can potentially be abused to generate excessively large representations and consume undue amounts of the user’s memory or even hang their browser.
User agents must support representations at least 20 characters long,
but they may choose to instead use the fallback style for representations that would be longer than 20 characters.
<p class=note> Note: All of the predefined additive <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rules in this specification
produce representations for every value in their range,
but it’s possible to produce values for <span class=css data-link-type=maybe>additive-symbols</span> that will fail to find a representation
with the algorithm defined above,
even though theoretically a representation could be found.
For example, if a <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> was defined with <span class=css data-link-type=maybe title=additive-symbols>additive-symbols: 3 "a", 2 "b";</span>,
the algorithm defined above will fail to find a representation for a counter value of 4,
even though theoretically a "bb" representation would work.
While unfortunate, this is required to maintain the property that the algorithm runs in linear time
relative to the size of the counter value.
<h4 class="heading settled heading" data-level=3.1.7 id=override-system><span class=secno>3.1.7 </span><span class=content>
Tweaking Existing Counter Styles: the <a class=css data-link-type=maybe href=#valuedef-override>override</a> system</span><a class=self-link href=#override-system></a></h4>
<p> The <dfn class=css-code data-dfn-for=@counter-style/system data-dfn-type=value data-export="" id=valuedef-override>override<a class=self-link href=#valuedef-override></a></dfn> system allows an author to use the algorithm of another counter style,
but alter other aspects,
such as the negative sign or the suffix.
If a counter style uses the <a class=css data-link-type=maybe href=#valuedef-override>override</a> system,
any unspecified descriptors must be taken from the overridden counter style specified,
rather than taking their initial values.
<p> If a @counter-style uses the <a class=css data-link-type=maybe href=#valuedef-override>override</a> system,
it must not contain a <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> or <a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptor,
or else the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule is invalid.
If the specified counter style name isn’t the name of any currently-defined counter style,
it must be treated as if it was overriding the <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a> counter style.
<h3 class="heading settled heading" data-level=3.2 id=counter-style-negative><span class=secno>3.2 </span><span class=content>
Formatting negative values: the <a class=property data-link-type=propdesc href=#descdef-negative title=negative>negative</a> descriptor</span><a class=self-link href=#counter-style-negative></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-negative>negative<a class=self-link href=#descdef-negative></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>?<tr><th>Initial:<td>"\2D" ("-" hyphen-minus)</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-negative title=negative>negative</a> descriptor defines how to alter the representation when
the counter value is negative.
<p> The first <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> in the value is prepended to the representation when the
counter value is negative. The second <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>, if specified, is appended
to the representation when the counter value is negative.
<div class=example>
For example, specifying <span class=css data-link-type=maybe title=negative>negative: "(" ")";</span> will make negative
values be wrapped in parentheses, which is sometimes used in financial
contexts, like "(2) (1) 0 1 2 3...".
</div>
<p> Not all <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> values use a negative sign.
In particular, a counter style is <dfn data-dfn-type=dfn data-export="" id=negative-capable>negative-capable<a class=self-link href=#negative-capable></a></dfn>
is one where its <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> value is
<a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a>,
<a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a>,
<a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a>,
<a class=css data-link-type=maybe href=#valuedef-additive>additive</a>,
or <a class=css data-link-type=maybe href=#valuedef-override>override</a> if the overridden counter style is itself <a href=#negative-capable>negative-capable</a>.
If a counter style is not <a href=#negative-capable>negative-capable</a>,
it ignores the negative sign when <a href=#generate-a-counter-representation title="generate a counter representation">generating a counter representation</a>.
<h3 class="heading settled heading" data-level=3.3 id=counter-style-prefix><span class=secno>3.3 </span><span class=content>
Symbols before the marker: the <a class=property data-link-type=propdesc href=#descdef-prefix title=prefix>prefix</a> descriptor</span><a class=self-link href=#counter-style-prefix></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-prefix>prefix<a class=self-link href=#descdef-prefix></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a><tr><th>Initial:<td>"" (the empty string)</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-prefix title=prefix>prefix</a> descripter specifies a <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> that is prepended to the
marker representation. Prefixes are only added by the algorithm for constructing
the default contents of the <span class=css data-link-type=maybe>::marker</span> pseudo-element; the prefix is not
added automatically when the counter() or counters() functions are used.
Prefixes come before any negative sign.
<h3 class="heading settled heading" data-level=3.4 id=counter-style-suffix><span class=secno>3.4 </span><span class=content>
Symbols after the marker: the <a class=property data-link-type=propdesc href=#descdef-suffix title=suffix>suffix</a> descriptor</span><a class=self-link href=#counter-style-suffix></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-suffix>suffix<a class=self-link href=#descdef-suffix></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a><tr><th>Initial:<td>"\2E" ("." full stop)</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-suffix title=suffix>suffix</a> descripter specifies a <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> that is appended to the
marker representation. Suffixes are only added by the algorithm for constructing
the default contents of the <span class=css data-link-type=maybe>::marker</span> pseudo-element; the suffix is not
added automatically when the counter() or counters() functions are used.
Suffixes are added to the representation after negative signs.
<h3 class="heading settled heading" data-level=3.5 id=counter-style-range><span class=secno>3.5 </span><span class=content>
Limiting the counter scope: the <a class=property data-link-type=propdesc href=#descdef-range title=range>range</a> descriptor</span><a class=self-link href=#counter-style-range></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-range>range<a class=self-link href=#descdef-range></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td>[ [ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> | infinite ]{2} ]# | auto<tr><th>Initial:<td>auto</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-range title=range>range</a> descriptor defines the ranges over which the counter style is defined.
If a counter style is used to represent a counter value outside of its ranges,
the counter style instead drops down to its fallback counter style.
<dl data-dfn-for=@counter-style/range>
<dt><dfn class=css-code data-dfn-for=@counter-style/range data-dfn-type=value data-export="" id=valuedef-auto0>auto<a class=self-link href=#valuedef-auto0></a></dfn>
<dd>
The range depends on the counter system.
For <a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a>, <a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a>, and <a class=css data-link-type=maybe href=#valuedef-fixed>fixed</a> systems,
the range is negative infinity to positive infinity.
For <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a> and <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a> systems,
the range is 1 to positive infinity.
For <a class=css data-link-type=maybe href=#valuedef-additive>additive</a> systems,
the range is 0 to positive infinity.
For <a class=css data-link-type=maybe href=#valuedef-override>override</a> systems,
the range is identical to the overridden system.
<dt>[ [ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> | infinite ]{2} ]#
<dd>
This defines a comma-separated list of ranges.
For each individual range,
the first value is the lower bound
and the second value is the upper bound.
This range is inclusive - it contains both the lower and upper bound numbers.
If <span class=css data-link-type=maybe>infinite</span> is used as the first value in a range,
it represents negative infinity;
if used as the second value,
it represents positive infinity.
The range of the counter style is the union of all the ranges defined in the list.
<p> If the lower bound of any range is higher than the upper bound,
the entire descriptor is invalid and must be ignored.
</dl>
<p> Implementations must support ranges with a lower bound of at least -2<sup>15</sup>
and an upper bound of at least 2<sup>15</sup>-1
(the range of a signed 2-byte int).
They may support higher ranges.
If any specified bound is outside of the implementation’s supported bounds,
it must be treated as the closest bound that the implementation does support.
<h3 class="heading settled heading" data-level=3.6 id=counter-style-pad><span class=secno>3.6 </span><span class=content>
Zero-Padding and Constant-Width Representations: the <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> descriptor</span><a class=self-link href=#counter-style-pad></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-pad>pad<a class=self-link href=#descdef-pad></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> && <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a><tr><th>Initial:<td>0 ""</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> descriptor allows an author to specify a "fixed-width" counter style,
where representations shorter than the pad value are padded with a particular <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>.
Representations larger than the specified pad value are constructed as normal.
<dl>
<dt><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> && <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>
<dd>
The <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> specifies a minimum number of <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s that all counter representations must reach.
If a counter representation would be generated using less <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s than the specified <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a>
(before adding prefixes/suffixes/negatives),
prepend copies of the specified <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> to the representation
until the number of symbols reaches the specified pad value.
<p> The <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> must be non-negative.
A negative value is a syntax error.
<p> If the counter value is negative
and the counter style is <a href=#negative-capable>negative-capable</a>,
treat the minimum number of <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s as being one or two smaller when determining how many copies to prepend,
depending on whether the <a class=property data-link-type=propdesc href=#descdef-negative title=negative>negative</a> descriptor’s value is one or two <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s.
</dl>
<div class=example>
The most common example of "fixed-width" numbering is zero-padded decimal numbering.
If an author knows that the numbers used will be less than a thousand, for example,
it can be zero-padded with a simple <a class=css data-link-type=maybe href=http://www.w3.org/TR/CSS21/visudet.html#propdef-width title=width>width: 3 "0";</a> descriptor,
ensuring that all of the representations are 3 digits wide.
<p> This will cause, for example,
1 to be represented as "001",
20 to be represented as "020",
300 to be represented as "300",
4000 to be represented as "4000",
and -5 to be represented as "-05".
</div>
<p class=note> Note: The <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> descriptor counts the number of <em><a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s</em> used to construct the representation,
not the number of characters,
and also pads the representation with <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s.
For many styles, the distinction is irrelevant,
as all the <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s are single-chararacter,
but if a style uses multi-character <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>s,
care must be taken not to accidentally specify <a class=property data-link-type=propdesc href=#descdef-pad title=pad>pad</a> in terms of characters.
<h3 class="heading settled heading" data-level=3.7 id=counter-style-fallback><span class=secno>3.7 </span><span class=content>
Defining fallback: the <a class=property data-link-type=propdesc href=#descdef-fallback title=fallback>fallback</a> descriptor</span><a class=self-link href=#counter-style-fallback></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-fallback>fallback<a class=self-link href=#descdef-fallback></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=#typedef-counter-style-name><counter-style-name></a><tr><th>Initial:<td>decimal</table>
<p> The <a class=property data-link-type=propdesc href=#descdef-fallback title=fallback>fallback</a> descriptor specifies a fallback counter style to be used
when the current counter style can’t create a representation for a given
counter value. For example, if a counter style defined with a range of 1-10
is asked to represent a counter value of 11, the counter value’s representation
is instead constructed with the fallback counter style (or possibly the
fallback style’s fallback style, if the fallback style can’t represent that
value, etc.).
<p> If the value of the <a class=property data-link-type=propdesc href=#descdef-fallback title=fallback>fallback</a> descriptor isn’t the name of any
currently-defined counter style, the used value of the <a class=property data-link-type=propdesc href=#descdef-fallback title=fallback>fallback</a> descriptor
is <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a> instead. Similarly, while following fallbacks to find
a counter style that can render the given counter value, if a loop in the
specified fallbacks is detected, the <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a> style must be used instead.
<p class=note>Note that it is not necessarily an error to specify fallback
loops. For example, if an author desires a counter style with significantly
different representations for even and odd counter values, they may find it
easiest to define one style that can only represent odd values and one that
can only represent even values, and specify each as the fallback for the
other one. Though the fallback graph is circular, at no point do you encounter
a loop while following these fallbacks - every counter value is represented
by one or the other counter style.
<h3 class="heading settled heading" data-level=3.8 id=counter-style-symbols><span class=secno>3.8 </span><span class=content>
Marker characters: the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> and <a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptors</span><a class=self-link href=#counter-style-symbols></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-symbols>symbols<a class=self-link href=#descdef-symbols></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td><a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a>+<tr><th>Initial:<td>n/a</table>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-additive-symbols>additive-symbols<a class=self-link href=#descdef-additive-symbols></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td>[ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-syntax-3/#typedef-integer><integer></a> && <a class="production css-code" data-link-type=type href=#typedef-symbol><symbol></a> ]#<tr><th>Initial:<td>n/a</table>
<pre class=prod><dfn class=css-code data-dfn-type=type data-export="" id=typedef-symbol><symbol><a class=self-link href=#typedef-symbol></a></dfn> = <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value><string></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type><image></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident><ident></a></pre>
<p> The <a class=property data-link-type=propdesc href=#descdef-symbols title=sym
8096
bols>symbols</a> and <a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptors specify the symbols
used by the marker-construction algorithm specified by the <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> descriptor.
The <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must be specified if the counter system is <a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a>,
<a class=css-code data-link-for=system data-link-type=value href=#valuedef-numeric0>numeric</a>, <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a>, <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a>, or <a class=css data-link-type=maybe href=#valuedef-fixed>fixed</a>, and the
<a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptor must be specified if the counter system is
<a class=css data-link-type=maybe href=#valuedef-additive>additive</a>; otherwise, the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> is invalid and must be ignored.
<p> Some counter systems specify that the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor must have at
least two entries. If the counter style’s system is such, and the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a>
descriptor has only a single entry, the counter style is invalid and must
be ignored.
<p> Each entry in the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor’s value defines a <dfn data-dfn-type=dfn data-export="" id=counter-symbol>counter symbol<a class=self-link href=#counter-symbol></a></dfn>,
which is interpreted differently based on the counter style’s system. Each
entry in the <a class=property data-link-type=propdesc href=#descdef-additive-symbols title=additive-symbols>additive-symbols</a> descriptor’s value defines an <dfn data-dfn-type=dfn data-export="" id=additive-tuple>additive tuple<a class=self-link href=#additive-tuple></a></dfn>,
which consists of a <a href=#counter-symbol>counter symbol</a> and a non-negative integer weight.
Each weight must be a non-negative integer, and the <a href=#additive-tuple>additive tuples</a>
must be specified in order of descending weight; otherwise, the @counter-style
is invalid and must be ignored.
<p> <a href=#counter-symbol>Counter symbols</a> may be strings, images, or identifiers,
and the three types can be mixed in a single descriptor.
Counter representations are constructed by concatenating counter symbols together.
Identifiers are rendered as strings containing the same characters.
Images are rendered as inline replaced elements.
The <a href=http://dev.w3.org/csswg/css3-images/#default-object-size>default object size</a> of an image <a href=#counter-symbol>counter symbol</a> is a 1em by 1em square.
<p class=note> Note: If using identifiers rather than strings to define the symbols,
be aware of the syntax of identifiers.
In particular, ascii non-letters like "*" are not identifiers,
and so must be quoted in a string.
Hex escapes,
used in several of the counter styles defined in this specification,
"eat" the following space
(to allow a digit to follow a hex escape without ambiguity),
so two spaces must be put after a hex escape
to separate it from the following one,
or else they’ll be considered adjacent,
and part of the same identifier.
<h3 class="heading settled heading" data-level=3.9 id=counter-style-speak-as><span class=secno>3.9 </span><span class=content>
Speech Synthesis: the <a class=property data-link-type=propdesc href=#descdef-speak-as title=speak-as>speak-as</a> descriptor</span><a class=self-link href=#counter-style-speak-as></a></h3>
<table class=descdef data-dfn-for="<a at-rule>@counter-style</a>"><tr><th>Name:<td><dfn class=css-code data-dfn-for="<a at-rule>@counter-style</a>" data-dfn-type=descriptor data-export="" id=descdef-speak-as>speak-as<a class=self-link href=#descdef-speak-as></a></dfn><tr><th>For:<td><a class=css-code data-link-type=at-rule href=#at-ruledef-counter-style>@counter-style</a><tr><th>Value:<td>auto | numeric | alphabetic | bullet | <a class="production css-code" data-link-type=type href=#typedef-counter-style-name><counter-style-name></a><tr><th>Initial:<td>auto</table>
<p> A counter style can be constructed with a meaning that is obvious visually,
but impossible to meaningfully represent via a speech synthesizer,
or possible but nonsensical when naively read out.
The <a class=property data-link-type=propdesc href=#descdef-speak-as title=speak-as>speak-as</a> descriptor describes how to synthesize the spoken form of a counter formatted with the given counter style.
Values have the following meanings:
<dl data-dfn-for=@counter-style/speak-as>
<dt><dfn class=css-code data-dfn-for=@counter-style/speak-as data-dfn-type=value data-export="" id=valuedef-auto>auto<a class=self-link href=#valuedef-auto></a></dfn>
<dd>
If the counter style’s <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> is <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a>, this value computes to <a class=css-code data-link-for=speak-as data-link-type=value href=#valuedef-alphabetic>alphabetic</a>.
If the <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> is <a class=css data-link-type=maybe href=#valuedef-cyclic>cyclic</a>, this value computes to <a class=css data-link-type=maybe href=#valuedef-bullet>bullet</a>.
Otherwise, this value computes to <a class=css-code data-link-for=speak-as data-link-type=value href=#valuedef-numeric>numeric</a>.
<dt><dfn class=css-code data-dfn-for=@counter-style/speak-as data-dfn-type=value data-export="" id=valuedef-numeric>numeric<a class=self-link href=#valuedef-numeric></a></dfn>
<dd>
The counter’s value is spoken as a number in the document language.
<dt><dfn class=css-code data-dfn-for=@counter-style/speak-as data-dfn-type=value data-export="" id=valuedef-alphabetic>alphabetic<a class=self-link href=#valuedef-alphabetic></a></dfn>
<dd>
<a href=#generate-a-counter-representation>Generate a counter representation</a> for the value as normal,
then spell it out letter-by-letter in the document language.
If the UA does not know how to pronounce the symbols,
it may handle it as <a class=css-code data-link-for=speak-as data-link-type=value href=#valuedef-numeric>numeric</a>.
<p> For example, <a class=css data-link-type=maybe href=#valuedef-lower-greek>lower-greek</a> in English would be read out as "alpha", "beta", "gamma", etc.
Conversely, <a class=css data-link-type=maybe href=#valuedef-upper-latin>upper-latin</a> in French would be read out as (in phonetic notation) /a/, /be/, /se/, etc.
<dt><dfn class=css-code data-dfn-for=@counter-style/speak-as data-dfn-type=value data-export="" id=valuedef-bullet>bullet<a class=self-link href=#valuedef-bullet></a></dfn>
<dd>
The UA speaks a UA-defined phrase or audio cue that represents a list item being read out.
<dt><dfn class=css-code data-dfn-for=@counter-style/speak-as data-dfn-type=value data-export="" id=valuedef-counter-style-name><a class="production css-code" data-link-type=type href=#typedef-counter-style-name><counter-style-name></a><a class=self-link href=#valuedef-counter-style-name></a></dfn>
<dd>
The counter’s value is instead spoken out in the specific style.
If the specified style does not exist,
this value is treated as <a class=css-code data-link-for=speak-as data-link-type=value href=#valuedef-auto>auto</a>.
</dl>
<div class=example>
The ability to defer pronunciation to another counter style can help when the symbols being used aren’t actually letters.
For example, here’s a possible definition of a <a class=css data-link-type=maybe href=#circled-lower-latin>circled-lower-latin</a> counter-style, using some special unicode characters:
<pre class=stylesheet>@counter-style <dfn data-dfn-type=dfn data-noexport="" id=circled-lower-latin>circled-lower-latin<a class=self-link href=#circled-lower-latin></a></dfn> {
system: alphabetic;
speak-as: lower-latin;
symbols: ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ;
suffix: "";
}
</pre>
<p> Setting its <a class=property data-link-type=propdesc href=#descdef-system title=system>system</a> to <a class=css-code data-link-for=system data-link-type=value href=#valuedef-alphabetic0>alphabetic</a> would normally make the UA try to read out the names of the characters,
but in this case that might be something like "Circled Letter A",
which is unlikely to make sense.
Instead, explicitly setting <a class=property data-link-type=propdesc href=#descdef-speak-as title=speak-as>speak-as</a> to <a class=css data-link-type=maybe href=#valuedef-lower-latin>lower-latin</a> ensures that they get read out as their corresponding latin letters, as intended.
</div>
<!-- ====================================================================== -->
<h2 class="heading settled heading" data-level=4 id=symbols-function><span class=secno>4 </span><span class=content>
Defining Anonymous Counter Styles: the <a class=css data-link-type=maybe href=#funcdef-symbols>symbols()</a> function</span><a class=self-link href=#symbols-function></a></h2>
<p> The <a class=css data-link-type=maybe href=#funcdef-symbols>symbols()</a> function allows a <a href=#counter-style>counter style</a> to be defined inline in a property value,
for when a style is used only once in a stylesheet and defining a full <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule would be overkill.
It does not provide the full feature-set of the <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule,
but provides a sufficient subset to still be useful.
The syntax of the <a class=css data-link-type=maybe href=#funcdef-symbols>symbols()</a> rule is:
<pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-symbols>symbols()<a class=self-link href=#funcdef-symbols></a></dfn> = symbols( <a class="production css-code" data-link-type=type href=#typedef-symbols-type><symbols-type></a>? [ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value><string></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type><image></a> ]+ );
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-symbols-type><symbols-type><a class=self-link href=#typedef-symbols-type></a></dfn> = cyclic | numeric | alphabetic | symbolic | fixed;
</pre>
<p> The <a class=css data-link-type=maybe href=#funcdef-symbols>symbols()</a> function defines an anonymous counter style
with no name,
a <a class=property data-link-type=propdesc href=#descdef-prefix title=prefix>prefix</a> and <a class=property data-link-type=propdesc href=#descdef-suffix title=suffix>suffix</a> of <span class=css data-link-type=maybe>""</span> (the empty string),
a <a class=property data-link-type=propdesc href=#descdef-range title=range>range</a> of <a class=css-code data-link-for=range data-link-type=value href=#valuedef-auto0>auto</a>,
a <a class=property data-link-type=propdesc href=#descdef-fallback title=fallback>fallback</a> of <a class=css data-link-type=maybe href=#valuedef-decimal>decimal</a>,
and a <a class=property data-link-type=propdesc href=#descdef-negative title=negative>negative</a> of <span class=css data-link-type=maybe>"\2D"</span> ("-" hyphen-minus).
The counter style’s algorithm is constructed
by consulting the previous chapter using the provided system —
or <a class=css data-link-type=maybe href=#valuedef-symbolic>symbolic</a> if the system was omitted —
and the provided <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#string-value><string></a>s and <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type><image></a>s as the value of the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> property.
If the system is <a class=css data-link-type=maybe href=#valuedef-fixed>fixed</a>, the <a href=#first-symbol-value>first symbol value</a> is <span class=css data-link-type=maybe>1</span>.
<div class=example>
This code:
<pre>ol { list-style: symbols("*" "\2020" "\2021" "\A7"); }</pre>
<p> will produce lists that look like:
<pre>* One
† Two
‡ Three
§ Four
** Five
†† Six
‡‡ Seven
</pre>
<p> On the other hand, specifying the system of counter, like so:
<pre>ol { list-style: symbols(cyclic "*" "\2020" "\2021" "\A7"); }</pre>
<p> will produce lists that look like:
<pre>* One
† Two
‡ Three
§ Four
* Five
† Six
‡ Seven
</pre> </div>
<p class=note> Note: the <a class=css data-link-type=maybe href=#funcdef-symbols>symbols()</a> function only allows strings and images,
while the <a class=property data-link-type=propdesc href=#descdef-symbols title=symbols>symbols</a> descriptor of a <a class=css data-link-type=maybe href=#at-ruledef-counter-style>@counter-style</a> rule also allows identifiers.
<h2 class="heading settled heading" data-level=5 id=extending-css2><span class=secno>5 </span><span class=content>
Extending <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#list-style-type title=list-style-type>list-style-type</a>, <span class=css data-link-type=maybe>counter()</span>, and <span class=css data-link-type=maybe>counters()</span></span><a class=self-link href=#extending-css2></a></h2>
<p> In CSS Level 2 <a data-biblio-type=normative data-link-type=biblio href=#css21 title=CSS21>[CSS21]</a> the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-lists-3/#list-style-type title=list-style-type>list-style-type</a> property and the <span class=css data-link-type=maybe>counter()</span> and <span class=css data-link-type=maybe>counters()</span> notations