Skip to content

Commit eff6f47

Browse files
committed
[css-pseudo-4] Clean up definition/examples of fictional tag sequences for ::first-line
1 parent 7138498 commit eff6f47

File tree

1 file changed

+91
-56
lines changed

1 file changed

+91
-56
lines changed

css-pseudo-4/Overview.bs

Lines changed: 91 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ Typographic Pseudo-elements</h2>
5555
<h3 id="first-line-pseudo">
5656
The ::first-line pseudo-element</h3>
5757

58-
The <dfn>::first-line</dfn> pseudo-element describes the contents of
59-
the <a>first formatted line</a> of its <a>originating element</a>.
58+
The <dfn>::first-line</dfn> [=pseudo-element=] represents
59+
the contents of the [=first formatted line=]
60+
of its [=originating element=].
6061

6162
<div class="example">
6263
The rule below means
@@ -66,77 +67,49 @@ The ::first-line pseudo-element</h3>
6667

6768
The selector ''p::first-line''
6869
does not match any real document element.
69-
It does match a pseudo-element that conforming user agents
70-
will insert at the beginning of every <code>p</code> element.
70+
It instead matches a pseudo-element
71+
that the user agent will automatically insert
72+
at the beginning of every <code>p</code> element.
7173
</div>
7274

7375
Note: Note that the length of the first line depends on a number of factors,
7476
including the width of the page, the font size, etc.
7577

76-
<div class="example">
78+
<div class="example" id="first-line-example">
7779
For example, given an ordinary HTML [[HTML5]] paragraph such as:
7880

7981
<pre>
80-
&lt;P&gt;This is a somewhat long HTML
81-
paragraph that will be broken into several
82-
lines. The first line will be identified
83-
by a fictional tag sequence. The other lines
84-
will be treated as ordinary lines in the
85-
paragraph.&lt;/P&gt;
82+
&lt;P&gt;This is a somewhat long HTML paragraph
83+
that will be broken into several lines.
84+
The first line will be styled
85+
by the ‘::first-line’ pseudo-element.
86+
The other lines will be treated
87+
as ordinary lines in the paragraph.&lt;/P&gt;
8688
</pre>
8789

88-
The lines might be broken as follows:
90+
Depending on the width of the element,
91+
its lines might be broken as follows:
8992

9093
<pre>
9194
THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
92-
will be broken into several lines. The first
93-
line will be identified by a fictional tag
94-
sequence. The other lines will be treated as
95-
ordinary lines in the paragraph.
96-
</pre>
97-
98-
This paragraph might be “rewritten” by user agents
99-
to include a <dfn>fictional tag sequence</dfn> to represent ''::first-line''.
100-
This <a>fictional tag sequence</a> helps to show how properties are inherited.
101-
102-
<pre>
103-
&lt;P&gt;<b>&lt;P::first-line&gt;</b> This is a somewhat long HTML
104-
paragraph that <b>&lt;/P::first-line&gt;</b> will be broken into several
105-
lines. The first line will be identified
106-
by a fictional tag sequence. The other lines
107-
will be treated as ordinary lines in the
108-
paragraph.&lt;/P&gt;
109-
</pre>
110-
</div>
111-
112-
If a pseudo-element breaks up a real element,
113-
the desired effect can often be described by a <a>fictional tag sequence</a>
114-
that closes and then re-opens the element.
115-
116-
<div class="example">
117-
Thus, if we mark up the previous paragraph with a <code>span</code>
118-
element encompassing the first sentence:
119-
120-
<pre>
121-
&lt;P&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
122-
paragraph that will be broken into several
123-
lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
124-
by a fictional tag sequence. The other lines
125-
will be treated as ordinary lines in the
126-
paragraph.&lt;/P&gt;
95+
will be broken into several lines. The
96+
first line will be by the ‘::first-line’
97+
pseudo-element. The other lines will be
98+
treated as ordinary lines in the paragraph.
12799
</pre>
128100

129-
the user agent could simulate start and end tags for <code>span</code>
130-
when inserting the <a>fictional tag sequence</a> for ''::first-line''
131-
to get the correct inheritance behavior.
101+
or alternately as follows:
132102

133103
<pre>
134-
&lt;P&gt;&lt;P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> This is a somewhat long HTML
135-
paragraph that will <b>&lt;/SPAN&gt;</b>&lt;/P::first-line&gt;<b>&lt;SPAN class="test"&gt;</b> be broken into several
136-
lines.<b>&lt;/SPAN&gt;</b> The first line will be identified
137-
by a fictional tag sequence. The other lines
138-
will be treated as ordinary lines in the
139-
paragraph.&lt;/P&gt;
104+
THIS IS A SOMEWHAT LONG
105+
HTML paragraph that will
106+
be broken into several
107+
lines. The first line will
108+
be by the ‘::first-line’
109+
pseudo-element. The other
110+
lines will be treated as
111+
ordinary lines in the
112+
paragraph.
140113
</pre>
141114
</div>
142115

@@ -227,6 +200,68 @@ Inheritance and the ''::first-line'' Pseudo-element</h4>
227200
(The portion of a child element that does not occur on the first line
228201
always inherits from the non-pseudo parent.)
229202

203+
204+
<div class="example">
205+
In the common case (of standard inherited CSS properties),
206+
[=inheritance=] into and from a ''::first-line'' pseudo-element
207+
can be understood by writing out a <dfn>fictional tag sequence</dfn>
208+
to represent ''::first-line''.
209+
Consider the <a href="#first-line-example">earlier example</a>;
210+
in case of the first rendering, the fictional tag sequence would be:
211+
212+
<pre>
213+
&lt;P&gt;<strong>&lt;p::first-line></strong>This is a somewhat long HTML paragraph
214+
that<strong>&lt;/p::first-line></strong> will be broken into several lines.
215+
The first line will be styled
216+
by the ‘::first-line’ pseudo-element.
217+
The other lines will be treated
218+
as ordinary lines in the paragraph.&lt;/P&gt;
219+
</pre>
220+
221+
And in the case of the second rendering:
222+
223+
<pre>
224+
&lt;P&gt;<strong>&lt;p::first-line></strong>This is a somewhat long<strong>&lt;/p::first-line></strong> HTML paragraph
225+
that will be broken into several lines.
226+
The first line will be styled
227+
by the ‘::first-line’ pseudo-element.
228+
The other lines will be treated
229+
as ordinary lines in the paragraph.&lt;/P&gt;
230+
</pre>
231+
</div>
232+
233+
234+
<div class="example">
235+
If a pseudo-element breaks up a real element,
236+
the effect can often be described
237+
by a <a>fictional tag sequence</a>
238+
that closes and then re-opens the element.
239+
Suppose we mark up the earlier example
240+
with a <code>span</code> element encompassing the first sentence:
241+
242+
<pre>
243+
&lt;P&gt;<strong>&lt;span></strong>This is a somewhat long HTML paragraph
244+
that will be broken into several lines.<strong>&lt;/span></strong>
245+
The first line will be styled
246+
by the ‘::first-line’ pseudo-element.
247+
The other lines will be treated
248+
as ordinary lines in the paragraph.&lt;/P&gt;
249+
</pre>
250+
251+
The effect of the first rendering
252+
would be similar to the following [=fictional tag sequence=]:
253+
254+
<pre>
255+
&lt;P&lt;P&gt;<strong>&lt;p::first-line>&gt;&lt;span></strong>This is a somewhat long HTML paragraph
256+
that<strong>&lt;/span>&lt;/P&gt;&lt;p::first-line>&lt;span></strong> will be broken into several lines.<strong>&lt;/span></strong>
257+
The first line will be styled
258+
by the ‘::first-line’ pseudo-element.
259+
The other lines will be treated
260+
as ordinary lines in the paragraph.&lt;/P&gt;
261+
</pre>
262+
</div>
263+
264+
230265
<h3 id="first-letter-pseudo">
231266
The ::first-letter pseudo-element</h3>
232267

0 commit comments

Comments
 (0)