Skip to content

Commit bc178b2

Browse files
committed
[css-pseudo-4] Rewrite definition of first formatted line as a proper definition as outlined by Oriol in #1158
1 parent eff6f47 commit bc178b2

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

css-pseudo-4/Overview.bs

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,40 +117,51 @@ The ::first-line pseudo-element</h3>
117117
Finding the First Formatted Line</h4>
118118

119119
In CSS, the ''::first-line'' pseudo-element
120-
can only have an effect when attached to a <a>block container</a>.
121-
The <dfn export>first formatted line</dfn> of an element
122-
must occur inside a block-level descendant in the same flow
123-
(i.e., a block-level descendant that is not out-of-flow due to floating or positioning).
124-
125-
<div class="example">
126-
For example, the first line of the <code>DIV</code> in <code>&lt;DIV&gt;&lt;P&gt;This line...&lt;/P&gt;&lt;/DIV&gt;</code>
127-
is the first line of the <code>P</code>
128-
(assuming that both <code>P</code> and <code>DIV</code> are blocks).
129-
</div>
130-
131-
The first line of a [=block container=] which does not participate in a [=block formatting context=]
132-
(and likewise the first line of a [=table caption=])
120+
can only have an effect when attached to a <a>block container</a>:
121+
122+
* The <dfn export>first formatted line</dfn> of
123+
a [=block container=] that establishes an [=inline formatting context=]
124+
contains the [=inline-level=] content of its first [=line box=].
125+
* The [=first formatted line=] of
126+
a [=block container=] or [=multi-column container=]
127+
that contains [=block-level=] content
128+
(and is not a [=table wrapper box=])
129+
is the [=first formatted line=] of
130+
its first [=in-flow=] [=block-level=] child.
131+
If no such line exists,
132+
it has no [=first formatted line=].
133+
134+
Note: The [=first formatted line=] can be an empty line.
135+
For example, the first line of the <code>p</code> in
136+
<code>&lt;p&gt;&lt;br&gt;First&hellip;</code>
137+
doesn't contain any letters.
138+
Thus the word “First” is not on the first formatted line,
139+
and will not be affected by ''p::first-line''.
140+
141+
Note: The first line of a [=block container=]
142+
that does not participate in a [=block formatting context=]
133143
cannot be the first formatted line of an ancestor element.
134144
Thus, in <code>&lt;DIV&gt;&lt;P STYLE="display: inline-block"&gt;Hello&lt;BR&gt;Goodbye&lt;/P&gt; etcetera&lt;/DIV&gt;</code>
135-
the first formatted line of the <code>DIV</code> is not the line "Hello".
145+
the first formatted line of the <code>DIV</code> is not the line “Hello”,
146+
but rather the (otherwise empty) line that contains that entire inline block.
136147

137-
Note: Note that the first line of the <code>p</code> in this fragment:
138-
<code>&lt;p&gt;&lt;br&gt;First...</code>
139-
doesn't contain any letters (assuming the default style for <code>br</code>).
140-
The word "First" is not on the first formatted line.
141-
142-
A user agent must act as if the fictional start tags of a ''::first-line'' pseudo-element
143-
were nested just inside the innermost enclosing block-level element.
148+
When a [=first formatted line=] is represented
149+
by multiple ''::first-line'' pseudo-elements,
150+
they are nested in the same order as their [=originating elements=].
144151

145152
<div class="example">
146-
For example, the <a>fictional tag sequence</a> for
153+
Consider the following markup:
147154
<pre>
148155
&lt;DIV&gt;
149156
&lt;P&gt;First paragraph&lt;/P&gt;
150157
&lt;P&gt;Second paragraph&lt;/P&gt;
151158
&lt;/DIV&gt;
152159
</pre>
153-
is
160+
161+
If we assume a [=fictional tag sequence=] to represent
162+
the elements’ ''::first-line'' pseudo elements,
163+
it would be something like:
164+
154165
<pre>
155166
&lt;DIV&gt;
156167
&lt;P&gt;&lt;DIV::first-line&gt;&lt;P::first-line&gt;First paragraph&lt;/P::first-line&gt;&lt;/DIV::first-line&gt;&lt;/P&gt;

0 commit comments

Comments
 (0)