-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.src.html
More file actions
2357 lines (1877 loc) · 84.9 KB
/
Overview.src.html
File metadata and controls
2357 lines (1877 loc) · 84.9 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 public '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'> <!--*- Mode: Text; fill-column: 95 -*-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>CSS3 Generated and Replaced Content Module</title>
<link rel="stylesheet" type="text/css" href="../default.css">
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED.css">
<style type="text/css">
.green { color: green; }
.navy { color: navy; }
.purple { color: purple; }
</style>
</head>
<!-- TODO:
!
! * place 'property' into marked up property elements
! * similarly with '::pseudo' and examples
! * http://lists.w3.org/Archives/Member/w3c-css-wg/2003JanMar/0170.html
! * string-set and co
! * need to increment the footnote, endnote and section-note counters
! * cross references, as in http://www.w3.org/Style/Group/2001/MO-css3-page-20010205
! * date() and time()
! * drop nesting
!
!-->
<body>
<div class="head">
<p><a rel="home" href="http://www.w3.org/" class="logo"><img height="48"
width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"></a><a
rel="in-activity" href="../../" class="logo"><img
src="../../../Woolly/woolly-icon.png" alt="CSS WG"></a></p>
<h1>CSS3 Generated and Replaced Content Module</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE: 10 July 2005]</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://dev.w3.org/csswg/css3-content/">http://dev.w3.org/csswg/css3-content/</a></dd>
<!-- <dd><a
href="http://www.w3.org/TR/[YEAR]/WD-css3-content-[CDATE]">http://www.w3.org/TR/[YEAR]/WD-css3-content-[CDATE]</a></dd> -->
<dt>Latest version:</dt>
<dd><a
href="http://www.w3.org/TR/css3-content">http://www.w3.org/TR/css3-content</a></dd>
<dt>Previous versions:</dt>
<dd><a href="http://www.w3.org/TR/2003/WD-css3-content-20030514/">http://www.w3.org/TR/2003/WD-css3-content-20030514/</a></dd>
<dd><a href="http://www.w3.org/TR/1998/REC-CSS2-19980512/generate.html">http://www.w3.org/TR/1998/REC-CSS2-19980512/generate.html</a></dd>
<dt>Editors:</dt>
<dd>Ian Hickson, <a href="mailto:ian@hixie.ch">ian@hixie.ch</a></dd>
</dl>
<!--begin-copyright-->
<p>[Here will be included the file "../copyright.inc"]</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This CSS3 Module describes how to insert and move content around a
document, in order to create footnotes, endnotes, section notes. Inserted
content can also introduce counters and strings, which can be used for
running headers and footers, section numbering, and lists. Finally,
techniques for declaring replaced images, as well as scaling and cropping
them using CSS, are described.</p>
<h2 class="no-num" id="status">Status of this document</h2>
<p>This is <em>not yet</em> a working draft of a CSS level 3 module. It aspires to eventually
become a CSS3 Recommendation.</p>
<p>This document is written in the context of the CSS working group which is part of the <a
href="http://www.w3.org/Style/">style activity</a> (see <a
href="http://www.w3.org/Style/Activity">summary</a>).</p>
<p>Comments on, and discussions of this draft can be sent on the (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a
href="mailto:www-style@w3.org">www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>). W3C Members can also send comments
directly to the CSS working group.</p>
<p>This is a working draft and may therefore be updated, replaced or rendered obsolete by other
W3C documents at any time. It is inappropriate to use W3C Working Drafts as reference material
or to cite them as other than "work in progress". Its publication does not imply endorsement by
the W3C membership or the <a href="http://www.w3.org/Style/Group">CSS Working Group</a> (<a
href="http://cgi.w3.org/MemberAccess/AccessRequest">members only</a>).</p>
<p>Patent disclosures relevant to CSS may be found on the Working Group's public <a
href="http://www.w3.org/Style/CSS/Disclosures">patent disclosure page.</a></p>
<p>To find the latest version of this working draft, please follow the "Latest version" link
above, or visit the list of W3C <a href="http://www.w3.org/TR/">Technical Reports</a>.</p>
<p>This document may be available in translations in the future. The English version of this
specification is the only normative version.</p>
<h3 class="no-num" id="crec">Candidate Recommendation Exit Criteria</h3>
<p>For this specification to exit the CR stage, the following conditions must be met:</p>
<ol>
<li>
<p>There must be at least two interoperable implementations
for every feature. For the purposes of this criterion,
we define the following terms:</p>
<dl>
<dt>feature</dt>
<dd>
<p>
A section or subsection of the specification.
</p>
</dd>
<dt>interoperable</dt>
<dd>
<p>passing the respective test cases in the test suite, or,
if the implementation is not a web browser, equivalent tests.
Every relevant test in the test suite should have an equivalent
test created if such a UA is to be used to claim interoperability.
In addition if such a UA is to be used to claim interoperability,
then there must one or more additional UAs which can also pass
those equivalent tests in the same way for the purpose of
interoperability. The equivalent tests must be made publicly
available for the purposes of peer review.</p>
</dd>
<dt>implementation</dt>
<dd>
<p>a user agent which:</p>
<ol class=inline>
<li>implements the feature.</li>
<li>is available (i.e. publicly downloadable or available
through some other public point of sale mechanism). This is the
"show me" requirement.</li>
<li>is shipping (i.e. development, private or unofficial
versions are insufficient).</li>
<li>is not experimental (i.e. is intended for a wide audience
and could be used on a daily basis).</li>
</ol>
</dd>
</dl>
</li>
<li><p>For every feature, error handling must be well defined, and
non-supporting UAs with a significant market share (if any) must
interoperate on correct error handling, even if supporting UAs
interoperate on the correct support as per the previous criterion.
For the purposes of this criterion, we further define the following
terms:</p>
<dl>
<dt>error handling</dt>
<dd>...</dd>
<dt>non-supporting UAs with a significant market share</dt>
<dd>...</dd>
<dt>interoperate</dt>
<dd>...</dd>
</dl>
</li>
<li><p>A minimum of six months of the CR period must have elapsed.
This is to ensure that enough time is given for any remaining major
errors to be caught.</p></li>
<li><p>The CR period will be extended if implementations are slow to
appear.</p></li>
<li><p>Features will be dropped (thus reducing the list of "all"
features mentioned above) if two or more interoperable
implementations of those features are not found by the end of the CR
period.</p></li>
<li><p>Features will also be dropped if sufficient and adequate
tests (by judgment of the working group) have not been produced for
those features by the end of the CR period.</p></li>
<li><p>If implementation feedback warrants it, or if implementations
are not found to be sufficiently interoperable, this specification
will be returned to Working Draft stage to address the issues
raised and reasons for implementation differences.</p></li>
</ol>
<h2 class="no-num no-toc"
8096
; id="contents">Table of contents</h2>
<!--toc-->
<h2 id="dependencies">Dependencies on other modules</h2>
<p>This CSS3 module depends on the following other CSS3 modules:</p>
<ul>
<li><cite>CSS3 module: syntax</cite> [[!CSS3SYN]]</li>
<li><cite>CSS3 module: values and units</cite> [[!CSS3VAL]]</li>
<li><cite>CSS3 module: selectors</cite> [[!SELECT]]</li>
<li><cite>CSS3 module: lists</cite> [[!CSS3LIST]]</li>
<li><cite>CSS3 module: block box model</cite> [[!CSS3BOX]]</li>
<li><cite>CSS3 module: inline box model</cite> [[!CSS3LINE]]</li>
<li><cite>CSS3 module: paged media</cite> [[!CSS3PAGE]]</li>
</ul>
<!--=======================================================================-->
<h2>Introduction</h2>
<p>In some cases, authors may want user agents to render content that
does not come from the document tree. One familiar example of this is
a numbered list; the author does not want to mark the numbers up
explicitly, he or she wants the user agent to generate them
automatically. Counters and markers are used to achieve these
effects.</p>
<pre>
ol { counter-reset: item; }
li { display: list-item; counter-increment: item; }
li::marker { content: counter(item, decimal) '.'; }
</pre>
<p>A simpler way to write this is:</p>
<pre>
li { display: list-item; list-style: decimal; }
</pre>
<p>Similarly, authors may want the user agent to insert the word
"Figure" before the caption of a figure, or "Chapter 7" on a line
before the seventh chapter title.</p>
<pre>
figure > caption::before { content: "Figure: "; }
chapter:nth-child(7) > title::before { content: "Chapter 7\A"; }
</pre>
<p>The last example could also be written in a more generic way using
counters:</p>
<pre>
chapter { counter-increment: chapter; }
chapter > title::before { content: "Chapter " counter(chapter) "\A"; }
</pre>
<p>Another common effect is replacing elements with images or other
multimedia content. Since not all user agents support all multimedia
formats, fallbacks may have to be provided.</p>
<pre>
/* Replace <logo> elements with the site's logo, using a format
* supported by the UA */
logo { content: url(logo.mov), url(logo.mng), url(logo.png), none; }
/* Replace <figure> elements with the referenced document, or,
* failing that, with either the contents of the alt attribute or the
* contents of the element itself if there is no alt attribute */
figure[alt] { content: attr(href, url), attr(alt); }
figure:not([alt]) { content: attr(href, url), contents; }
</pre>
<p>Authors may also wish to move content to a later position in a
document, for instance placing images at the bottom (or top) of the
page.</p>
<pre>
img { move-to: page-top; } /* move images to page-top */
@page { padding-top: 10em; } /* leave a gap at the top of the page */
body:after { /* place a box at the top of each page */
position: fixed; top: 0; left: 0; right: 0; height: 10em;
content: pending(page-top); /* insert the images moved to page-top */
}
</pre>
<p>In some cases, content may be inserted, alternate content moved to
a later place in the flow, and a list marker inserted next to this
alternate content. For example, footnotes or endnotes.</p>
<pre>
a[href]::after {
counter-increment: footnote-number;
content: counter(footnote-number, footnotes);
}
a[href]::after::alternate {
display: list-item;
content: attr(href);
move-to: footnotes;
}
a[href]::after::alternate::marker {
content: counter(footnote-number, footnotes);
}
@page {
counter-reset: footnote-number;
@footnote {
content: pending(footnotes);
}
}
</pre>
<p>Using initial values, the last example can also be written as:</p>
<pre>
a[href]::after { content: footnote; }
a[href]::after::alternate { content: attr(href); }
</pre>
<p>For simpler cases, e.g. where an element is simply to be used as an
endnote directly, only a single declaration is required.</p>
<pre>
p.note { content: endnote; }
</pre>
<p>The initial values of the other properties are set up so that the
result is as expected.</p>
<p>Another effect commonly requested by authors is that of line
numbering. This module introduces the '::line-marker' pseudo-element
that is attached to the front of every line box, which can be used for
this purpose.</p>
<pre>
pre { counter-reset: line; }
pre::line-marker { counter-increment: line; content: counter(line) "."; }
</pre>
<p>This pseudo-element can also be used to simulate the indentation
style found in e-mail communication:</p>
<pre>
blockquote { margin: 0; padding: 0 0 0 2em; } <!-- replace 'em' with 'ch' XXX -->
blockquote > blockquote { margin-left: -1em; }
blockquote::line-marker { width: 2em; text-align: left; content: ">"; }
</pre>
<p>Generated content based on the <code>cite</code> and
<code>datetime</code> attributes can create introductions or citations
on the fly as well.</p>
<h3>Conformance Requirements</h3>
<p>Finally, in this document, requirements are expressed using the key
words "MUST", "MUST NOT", "REQUIRED", "SHALL" and "SHALL NOT".
Recommendations are expressed using the key words "SHOULD", "SHOULD
NOT" and "RECOMMENDED". "MAY" and "OPTIONAL" are used to indicate
optional features or behavior. These keywords are used in accordance
with [[!RFC2119]]. For legibility these keywords are used in lowercase
form.</p>
<!--=======================================================================-->
<h2>Terminology</h2>
<p>This module introduces several pseudo-elements and allows them to nest in certain predefined
ways. In order to explain the relationships between these nested pseudo-elements, three new
terms have been coined.</p>
<dl>
<dt><dfn>superior parent</dfn></dt>
<dd>
A pseudo-element's superior parent is the element or pseudo-element
to which it is associated. e.g. the superior parent of the
pseudo-element matched by '::before::after' is the pseudo-element
matched by '::before', and <em>that</em> pseudo-element's superior parent
is the element itself. The suporior parent of an '::outside(<var>n</var>)'
pseudo-element is the '::outside(<var>n-1</var>)' pseudo-element. Note that an
element never has a superior parent, and a pseudo-element always
has exactly one.
</dd>
<dt><dfn>superior siblings</dfn></dt>
<dd> The '::before' or '::after' pseudo-elements that have lower numeric
arguments. e.g. '::before(2)' is a superior sibling of
'::before(5)'. Only '::before' and '::after' pseudo-elements with
numeric arguments greater than 1 have superior siblings.</dd>
<dt><dfn>superior</dfn></dt>
<dd> Any element or pseudo-element that is either a superior parent or
superior sibling.</dd>
</dl>
<p class="issue">These terms are horrible, but they were the only ones I could think of that didn't confusingly clash
with DOM terminology. Example of the horridness of the terms: the superior parent of an '::outside' pseudo-element is
its rendering tree child, whose rendering hree sibling '::before' has the '::outside' pseudo-element as its superior
parent.</p>
<p class="issue">We need a term which means "element or pseudo-element".</p>
<!--=======================================================================-->
<h2>Pseudo-elements</h2>
<p>At the heart of generated content lies pseudo-elements.
Pseudo-elements create abstractions about the document tree beyond
those specified by the document language. For instance, document
languages do not offer mechanisms to access the first letter or first
line of an element's content. CSS pseudo-elements allow style sheet
designers to refer to this otherwise inaccessible information.
Pseudo-elements also provide style sheet designers a way to assign
style to content that does not exist in the source document.</p>
<h3>Syntax</h3>
<p>Certain combinations of multiple pseudo-elements per selector are
allowed. All pseudo-elements must appear in a single chain at the end
of the selector, with no intervening combinators.</p>
<p>The pseudo-element part of the selector consists of an optional set
of "structural" pseudo-elements, optionally followed by a single
formatting pseudo-element.</p>
<p>The structural pseudo-elements are alternating sets of an
'::outside' pseudo-element and one or more '::before', '::after', or
'::alternate' pseudo-elements. (So basically any number of
'::outside', '::before', '::after', and '::alternate' pseudo-elements,
so long as no two '::outside' pseudo-elements are adjacent, as that is
meaningless.)</p>
<p>The formatting pseudo-elements are '::first-line',
'::first-letter', '::marker', '::line-marker', and '::selection'. Only
one of these may occur, and if present, it must be the last
pseudo-element in the chain.</p>
<p>The allowed order for pseudo-elements is formally described by the
following pseudo-BNF grammar:</p>
<pre>
pseudo-elements := structural-pseudo-elements? formatting-pseudo-element?
structural-pseudo-elements :=
( '::outside'? [ '::before' | '::after' | '::alternate' ] )* '::outside'?
formatting-pseudo-element :=
'::first-line' | '::first-letter' | '::marker' | '::line-marker' | '::selection'
</pre>
<p>The '::outside', '::before', and '::after' pseudo-elements have two
forms, '::outside', '::before', and '::after' and
'::outside(<var>n</var>)', '::before(<var>n</var>)', and
'::after(<var>n</var>)', where <var>n</var> is an integer. If the
parameter part is omitted then '1' is implied. For example,
'::before(1)' is the same as '::before'.</p>
<p>For compatability with previous levels of CSS, the '::before',
'::after', '::first-line' and '::first-letter' pseudo-elements do not
require two colons. This does not apply to any other pseudo-element.
Authors are encouraged to use the new two-colon forms.</p>
<!--=======================================================================-->
<h3>Inserting content into an element: the '::before' and '::after'
pseudo-elements</h3>
<p>The '::before' and '::after' pseudo-elements are used to insert
content immediately before and immediately after the content of an
element (or other pseudo-element). The 'content' propety is used to
specify the content to insert.</p>
<div class="example"> <p>For example, the following rule replaces the
content of <code><abbr></code> elements with the contents of the
element's <code>title</code> attribute:</p>
<pre>
abbr { content: attr(title); }
</pre>
<p>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>
<p>Typically, the '::before' and '::after' pseudo-elements inherit any
inheritable properties from the element in the document tree to which
they are attached. In the general case, they inherit their properties
from their superior parent.</p>
<p>For a '::before' or '::after' pseudo-element to be generated, all of the elements and
pseudo-elements leading to it must be generated, and the pseudo-element must not have its
'content' property set to 'inhibit' or its 'display' property set to 'none'. Note that for
'::before' and '::after' pseudo-elements, the initial value of 'content' computes to
'inhibit'.</p>
<p>Using a '::before' pseudo-element in the context of the anonymous table elements works
exactly as if an actualy element had been introduced. For example:</p>
<pre>
.example::before { content: "D" }
</pre>
<pre>
<table>
<tr>
<td>A</td> <td>B</td> <td>C</td>
</tr>
<tr class="example">
<td>E</td> <td>F</td>
</tr>
</table>
</pre>
<p>An anonymous table cell box is generated around the '::before' content in this case,
resulting in a 3×2 table.</p>
<h4>Nesting '::before' and '::after' pseudo-elements</h4>
<p>The selector '::before::before' represents a pseudo-element
contained at the start of a pseudo-element contained at the start of
an element.</p>
<p>For example, the following rules:</p>
<pre>
div { content: 'A' }
div::before { content: 'B'; }
div::before::before { content: 'C'; }
</pre>
<p>...would result in the following rendering objects:</p>
<pre>
,-----------------------.
| ,---------. |
| | ,---. | |
| | | C | B | A |
| | `---' | |
| `---------' |
`-----------------------'
</pre>
<h4>Inserting multiple '::before' and '::after' pseudo-elements</h4>
<p>In contrast with the previous section, the selector '::before(2)'
represents a pseudo-element before another, both of which are
contained at the start of an element.</p>
<p>For example, the following rules:</p>
<pre>
div { content: 'A' }
div::before { content: 'B'; }
div::before(2) { content: 'C'; }
</pre>
<p>...would result in the following rendering objects:</p>
<pre>
,-----------------------.
| ,---. ,---. |
| | C | | B | A |
| `---' `---' |
`-----------------------'
</pre>
<p>The '::before' selector is exactly equivalent to '::before(1)'.</p>
<p>A pseudo-element only exists if all the elements and
pseudo-elements leading up to it exist. For instance, in the following
example, only one pseudo-element is generated, the first one:</p>
<pre>
div { content: 'A' }
div::before { content: 'B'; }
div::before(2) { content: inhibit; }
div::before(3) { content: 'C'; }
</pre>
<p>It would result in the following rendering objects:</p>
<pre>
,-----------------------.
| ,---. |
| | B | A |
| `---' |
`-----------------------'
</pre>
<!--=======================================================================-->
<h3>Wrapping elements in pseudo-elements with '::outside'</h3>
<p>An '::outside' pseudo-element is one that is generated immediately
outside the pseudo-element's <span>superior</span>.</p>
<p>When given a parameter, '::outside(<var>n</var>)' represents an
<var>n</var>th pseudo-element generated immediately around the
<var>n-1</var>th pseudo-element.</p>
<p>For example, the following rules:</p>
<pre>
div { display: block; border: dashed; }
div::outside { display: block; border: dashed; }
div::outside(2) { display: block; border: dashed; }
</pre>
<p>...would result in the following rendering objects:</p>
<pre>
,-----------------------. <-- border of ::outside(2)
| ,-------------------. | <-- border of ::outside
| | ,---------------. | | <-- border of DIV
| | | DIV | | |
| | `---------------' | |
| `-------------------' |
`-----------------------'
</pre>
<p>A similar result would be achieved by using three nested DIV
elements (except of course that would require changing the document
source, which is not always possible).</p>
<p>One difference between using elements and using pseudo-elements is
that the pseudo-elements inherit from the elements (or
pseudo-elements) that generate them, not from those they are contained
within.</p>
<p>For example, if we assume the following rules:</p>
<pre>
div { display: block; border: green solid; }
div::outside(1) { display: block; border: inherit; }
div::outside(2) { display: block; border: red solid; }
</pre>
<p>...then the outermost border (from the '::outside(2)') will be red,
but the middle border (from '::outside(1)') will be the same colour as
the inner most border (from the element itself), namely green.</p>
<p>For an '::outside' pseudo-element to be generated, all of the
elements and pseudo-elements leading to it must be generated, and the
pseudo-element itself must not have its 'display' property set to
'none'. Note that the initial value of 'display' computes to 'none' on
'::outside' pseudo-elements.</p>
<p>It is possible to float an element and then give it an '::outside' pseudo-element, in which case the pseudo-element
is in-flow, not floated.</p>
<p>For example:</p>
<pre>
p { float: right; color: green; }
p::outside { display: inline; border: solid; }
</pre>
<p>...results in an empty inline element with a solid green border being placed in the flow at the point where the float
is taken out of flow.</p>
<p>When an element is moved with the 'move-to' property, however, '::outside' pseudo-elements are moved too.</p>
<p>The 'content' property does not apply to '::outside' pseudo-elements.</p>
<h4>Mixing '::outside' with '::before' and '::after'</h4>
<p>An '::outside' pseudo-element can have any number of '::before' or
'::after' pseudo-elements of its own. They are inserted before and
after the '::outside' pseudo-element's contents (the element or
pseudo-element that generated the '::outside' pseudo-element).</p>
<p>For example, the following rules:</p>
<pre>
span { content: "span"; }
span::before { content: "B"; }
span::outside(1) { display: inline; }
span::outside(1)::before { content: "A"; }
span::outside(2) { display: inline; }
span::outside(2)::after { content: "C"; }
</pre>
<p>...would result in the following rendering objects (including
construction lines for clarity):</p>
<pre>
,--------------------------------. <-- border of ::outside(2)
| ,----------------------. | <-- border of ::outside(1)
| | ,---. ,-+---+------. | ,---. | <-- border of span, ::before,
| | | A | | | B | span | | | C | | and ::after boxes
| | `---' `-+---+------' | `---' |
| `----------------------' |
`--------------------------------'
</pre>
<p>This can be used to leave markers in the flow, as in:</p>
<pre>
note { float: right; }
note::outside { display: inline; }
note::outside::before { content: " (see sidebar) "; }
</pre>
<p>Care must be taken when styling cases like this. If the note element was given a smaller 'font-size' or a different
'color', then, by default, the generated in-flow text would end up inheriting it.</p>
<!--=======================================================================-->
<h3>Inserting new content later in the document tree with '::alternate'</h3>
<p>This pseudo-element is created by setting its 'move-to' property to
an identifier. It is rendered at the next occurrence of 'pending()' in
a 'content' property.</p>
<p>In other respects it is just like a normal pseudo-element.</p>
<p>Note that '::alternate' pseudo-elements inherit from their
associated pseudo-element or element, not from the element in which
they are inserted. (The same applies to any content moved using
'move-to'). This is discussed in the section on the '<a
href="#pending-inheritance">pending()</a>' value</p>
<p>For an '::alternate' pseudo-element to be generated, all of the
elements and pseudo-elements leading to it must be generated, and the
pseudo-element must not have its 'display' property set to 'none', its
'content' property set to 'inhibit', or its 'move-to' property set to
'here'. Note that on '::alternate' pseudo-elements the initial value
of 'move-to' is 'here' and the initial value of 'content' is
'inhibit'.</p>
<h4>Mixing '::alternate' with '::outside', '::before', and '::after'</h4>
<p>An '::alternate' pseudo-element can have any number of '::outside',
'::before', or '::after' pseudo-elements of its own, and each of these
four structural pseudo elements can have an '::alternate'
pseudo-element of its own.</p>
<p>For example, the following rules:</p>
<pre>
span { content: "span"; color: green; }
span::alternate { content: "alternate1"; move-to: example1; }
span::alternate::before { content: "before1"; }
span::after { content: "after1" pending(example1); color: navy; }
span::after::alternate { content: "alternate2"; move-to: example2; }
span::after(2) { content: "after2" pending(example2); color: purple; }
</pre>
<p>...would result in the following rendering objects (including
construction lines for clarity):</p>
<pre>
,----------------------------------------------------------------------.
| ,-----------------------------------. |
| | ,------------------------. | ,-----------------------. |
| | | ,---------. | | | ,------------, | |
| <span class="green">span</span> | <span class="navy">after1</span> | | <span class="green">before1</span> | <span class="green">alternate1</span> | | | <span class="purple">after2</span> | <span class="navy">alternate2</span> | | |
| | | `---------' | | | `------------' | |
| | `------------------------' | '-----------------------' |
| `-----------------------------------' |
`----------------------------------------------------------------------'
</pre>
<!--=======================================================================-->
<h3>Block markers: The '::marker' pseudo-element</h3>
<p>For a '::marker' pseudo-element to be generated, its <span>superior
parent</span> must have a computed 'display' value of 'list-item'.</p>
<p>For further details on the rendering model for list markers, see
the CSS3 Lists module.</p>
<!-- XXX once that is CR, the text can move over to here for further
tweaks as necessary. -->
<!--=======================================================================-->
<h3>Line markers: The '::line-marker' pseudo-element</h3>
<p>The '::line-marker' pseudo-element is positioned in exactly the
same way as the '::marker' pseudo-element, but appears on every line,
not just the first.</p>
<p>Line boxes are responsible for generating '::line-marker'
pseudo-elements. For each line, one such marker is created for every
block ancestor in the current formatting context. (Formatting contexts
are created by the root element, floats, positioned content, cells, and
inline-blocks. See the CSS3 Box Model module for more information.
[[!CSS3BOX]]) In addition, the '::line-marker' pseudo-element itself
must have a 'content' property that has a computed value other than
'none' or 'inhibit'.</p>
<!-- XXX need examples. Also, show overlap of nested blocks' ::marker,
::line-marker, etc. -->
<!--=======================================================================-->
<h2>Moving content to later in the document: the 'move-to' property</h2>
<table class="propdef">
<tbody>
<tr>
<th>Name:</th>
<td><dfn>move-to</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td>normal | here | <identifier></td>
</tr>
<tr>
<th>Initial:</th>
<td>normal</td>
</tr>
<tr>
<th>Applies To:</th>
<td>all elements, ::before, ::after, and ::alternate</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>all</td>
</tr>
<tr>
<th>Computed value:</th>
<td>The specified value unless that is 'normal', as per the prose below.</td>
</tr>
</tbody>
</table>
<p>The 'move-to' property causes the element or pseudo-element to be removed from the flow and
reinserted at a later point in the document. The content is reinserted using the 'pending()'
<!-- XXX link --> value of the 'content' property.</p>
<p>This property applies to all elements as well as the '::before', '::after', and
'::alternate' pseudo-elements. The '::alternate' pseudo-element in fact exists exclusively for
the purpose of being moved by this property, e.g. in the creation of footnotes.</p>
<dl>
<dt><dfn>normal</dfn></dt>
<dd>
<p>For '::alternate' pseudo-elements, if the superior parent uses the 'footnote' counter in its 'content' property then
the computed value of 'move-to' is 'footnotes'.</p>
<p>For '::alternate' pseudo-elements, if the superior parent uses the 'endnote' counter in its 'content' property then
the computed value of 'move-to' is 'endnotes'.</p>
<p>For '::alternate' pseudo-elements, if the superior parent uses the 'section-note' counter in its 'content' property
then the computed value of 'move-to' is 'section-notes'.</p>
<p>Otherwise the computed value of the move-to property is 'here'.</p>
</dd>
<dt><dfn>here</dfn></dt>
<dd>The element or pseudo-element is not moved. This value inhibits
the creation of '::alternate' pseudo-elements and any pseudo-elements
that have such a pseudo-element as a superior. </dd>
<dt><identifier></dt>
<dd>The element is not displayed at the current location, but at the next occurrence of 'pending(<identifier>)'
(where the identifiers match), with all other elements moved to that point, in document order. If at the end af the
document (after the '::after' pseudo-elements of the root element) there are outstanding elements, then they are all
inserted in document order at that point.</dd>
</dl>
<p>Note that elements and pseudo-elements that have been moved using
'move-to' still inherit from their associated pseudo-element or
element, and not from the element in which they are inserted. This is
discussed in the section on the '<a
href="#pending-inheritance">pending()</a>'. value</p>
<!--=======================================================================-->
<h2>The 'display' property</h2>
<table class="propdef">
<tbody>
<tr>
<th>Name:</th>
<td><dfn>display</dfn></td>
</tr>
<tr>
<th>New values:</th>
<td>normal</td>
</tr>
<tr>
<th>Initial:</th>
<td>normal</td>
</tr>
<tr>
<th>Applies To:</th>
<td>all elements, ::before, ::after, ::alternate, and ::outside</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>all</td>
</tr>
<tr>
<th>Computed value:</th>
<td>The specified value unless that is 'normal', as described below.</td>
</tr>
</tbody>
</table>
<p>Note: all values apply to the four pseudo-elements listed. Thus you can create entire tables, insert rubies, or
generate other complex layouts using only generated content. This differs from CSS2 which only allowed a limited subset
of values to apply to each pseudo-element.</p>
<dl>
<dt><dfn>normal</dfn></dt>
<dd>
<p>For elements, '::before', and '::after', computes to 'inline'.</p>
<p>For '::alternate': if the superior parent's 'content' property uses the 'footnote', 'endnote', or 'section-note'
property then it computes to 'list-item', otherwise it computes to 'block'. Note that if the 'move-to' property doesn't
compute to an identifier then the '::alternate' pseudo-element isn't generated in the first place and therefore the
value of 'display' is not relevant. In those cases, 'normal' still computes as described above but the result does not
affect layout.</p>
<p>For '::outside', computes to 'none'. This prevents the generation of the pseudo-element, but does not stop the
pseudo-element's superior parent from being generated (as it would if the '::outside' pseudo-element was replaced by a
real element in an attempt to produce the same layout).</p>
</dd>
<dt><dfn>none</dfn><dt>
<dd>
<p>On elements, this inhibits the element, including any children and
any pseudo-elements which have this element as a superior parent, from
being rendered, anywhere.</p>
<p>On pseudo-elements, this inhibits the creation of the element and
furthermore prevents the creation of any pseudo-elements which have
this pseudo-element as a superior.</p>
</dd>
<dt><dfn>list-item</dfn></dt>
<dd>
<p>To declare a list item, the <span class="property">'display'</span> property should be set to 'list-item'. This, in
addition to generating a '::marker' pseudo-element and enabling the properties described
70E9
in the Lists module, causes
that element to increment the list item counter 'list-item'. (This does not affect the specified or computed values of
the counter properties.)</p>
<p>The 'list-item' counter is a real counter, and can be directly affected using the <span
class="property">'counter-increment'</span> and <span class="property">'counter-reset'</span> properties. It can also be
used in the 'counter()' and 'counters()' function forms.</p>
<p class="issue">The CSS3 box module may define other <span class="property">'display'</span> values which generate a
list marker. These should also affect the 'list-item' counter.</p>
</dd>
</dl>
<p>Note that the new list marker model makes the 'marker' display type
redundant. That display type is therefore obsolete in the CSS3 Lists
model.</p>
<p>Note that while this property doesn't apply to '::marker'
pseudo-elements, they only get generated if their superior parent has a
computed 'display' value of 'list-item', and they are always rendered
as if they had an 'inline-block' display type.</p>
<p>Similarly, while this property applies to '::before', '::after',
'::alternate', '::outside' those pseudo-elements only get generated if
they have no superiors with computed values of 'display' that are
'none' or superiors with computed values of 'content' that are
'inhibit'.</p>
<!--=======================================================================-->
<h2><a name="quotes-specify">Specifying quotes</a> with the <span
class="propinst-quotes">'quotes'</span> property</h2>
<table class="propdef">
<tbody>
<tr>
<th>Name:</th>
<td><dfn>quotes</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td>foo | bar</td>
</tr>
<tr>
<th>Initial:</th>
<td>text</td>
</tr>
<tr>
<th>Applies To:</th>
<td>all elements, ::before, ::after, ::alternate, ::marker, ::line-marker, margin areas, and @footnote areas</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>