Skip to content

Commit aee785b

Browse files
committed
[css-pseudo-4] Define ::prefix and ::postfix sub-elements of ::first-letter. #2040
1 parent e58be96 commit aee785b

File tree

1 file changed

+60
-14
lines changed

1 file changed

+60
-14
lines changed

css-pseudo-4/Overview.bs

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ Editor: Daniel Glazman, Disruptive Innovations, w3cid 13329
1616
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact, w3cid 35400
1717
Editor: Alan Stearns, Adobe Systems Inc., stearns@adobe.com, w3cid 46659
1818
Abstract: This CSS module defines pseudo-elements, abstract elements that represent portions of the CSS render tree that can be selected and styled.
19+
At Risk: the ''::prefix'' and ''::postfix'' sub-elements of ''::first-letter''
1920
Ignored Terms: initial-letter, PseudoElement, pseudo(), selectors
2021
Default Highlight: css
2122
Indent: 2
2223
</pre>
2324
<pre class="link-defaults">
24-
spec:css-color-3; type:value; text:currentcolor
25-
spec:css-color-3; type:property; text:color
25+
spec:css-color-4; type:value; text:currentcolor
26+
spec:css-color-4; type:property; text:color
2627
spec:fill-stroke-3; type:property; text:stroke-width
2728
</pre>
2829

@@ -53,7 +54,7 @@ spec:fill-stroke-3; type:property; text:stroke-width
5354
Typographic Pseudo-elements</h2>
5455

5556
<h3 id="first-line-pseudo">
56-
The ::first-line pseudo-element</h3>
57+
First-Line Text: the ''::first-line'' pseudo-element</h3>
5758

5859
The <dfn>::first-line</dfn> [=pseudo-element=] represents
5960
the contents of the [=first formatted line=]
@@ -171,7 +172,7 @@ Finding the First Formatted Line</h4>
171172
</div>
172173

173174
<h4 id="first-line-styling">
174-
Styling the First Line Pseudo-element</h4>
175+
Styling the ''::first-line'' Pseudo-element</h4>
175176

176177
The ''::first-line'' pseudo-element’s generated box
177178
behaves similar to that of an inline-level element, but with certain restrictions.
@@ -274,9 +275,9 @@ Inheritance and the ''::first-line'' Pseudo-element</h4>
274275

275276

276277
<h3 id="first-letter-pseudo">
277-
The ::first-letter pseudo-element</h3>
278+
First-Letter Text: ''::first-letter'' pseudo-element and its ''::prefix'' and ''::postfix'' children</h3>
278279

279-
The <dfn>::first-letter</dfn> pseudo-element represents
280+
The <dfn>::first-letter</dfn> [=pseudo-element=] represents
280281
the first <a>typographic letter unit</a> [[!CSS-TEXT-3]]
281282
on the <a>first formatted line</a> of its <a>originating element</a>,
282283
its <dfn>first-letter text</dfn>.
@@ -317,8 +318,20 @@ The ::first-letter pseudo-element</h3>
317318
<img alt="Quotes that precede the first letter should be included." src="images/first-letter2.gif">
318319
</div>
319320

321+
To allow independent styling of the first letter itself
322+
and its adjacent punctuation,
323+
any punctuation included in ''::first-letter''
324+
that comes before the first <a>typographic letter unit</a>
325+
is represented by the <dfn for="::first-letter">::prefix</dfn>
326+
sub-[=pseudo-element=] of the ''::first-letter'' [=pseudo-element=]
327+
(''::first-letter::prefix'');
328+
and any such punctuation that comes after the first <a>typographic letter unit</a>
329+
is represented by the <dfn for="::first-letter">::postfix</dfn>
330+
sub-[=pseudo-element=] of the ''::first-letter'' [=pseudo-element=]
331+
(''::first-letter::postfix'').
332+
320333
<h4 id="first-letter-application">
321-
Finding the First Letter Text</h4>
334+
Finding the First-Letter Text</h4>
322335

323336
As with ''::first-line'',
324337
the ''::first-letter'' pseudo-element
@@ -364,7 +377,7 @@ Finding the First Letter Text</h4>
364377
as its [=first formatted line=] contains no content besides the inline block.
365378

366379
<h4 id="first-letter-tree">
367-
Inheritance and Box Tree Structure of the ''::first-letter'' Pseudo-element</h4>
380+
Inheritance and Box Tree Structure of the First-Letter Pseudo-elements</h4>
368381

369382
The ''::first-letter'' pseudo-element is wrapped
370383
immediately around the [=first-letter text=] it represents,
@@ -387,20 +400,47 @@ Inheritance and Box Tree Structure of the ''::first-letter'' Pseudo-element</h4>
387400
to represent the elements’ ''::first-letter'' pseudo-elements,
388401
it would be something like:
389402

390-
<pre class="lang-markup">
403+
<pre>
391404
&lt;div&gt;
392405
&lt;p&gt;&lt;span&gt;<strong>&lt;div::first-letter&gt;&lt;p::first-letter&gt;</strong>T<strong>&lt;/&hellip;&gt;&lt;/&hellip;&gt;</strong>he first few words&lt;/span>
393406
and the rest of the paragraph.
394407
&lt;/div&gt;
395408
</pre>
396409
</div>
397410

411+
If any ''::first-letter::prefix'' or ''::first-letter::postfix'' [=pseudo-elements=] are required,
412+
they are nested within the innermost ''::first-letter'',
413+
and otherwise interpreted similar to ''::first-letter'' itself.
414+
415+
<div class="example">
416+
Consider the following markup:
417+
418+
<pre class="lang-markup">
419+
&lt;div&gt;
420+
&lt;p&gt;&lt;span&gt;“The first few words&lt;/span>
421+
and the rest of the quotation.
422+
&lt;/div&gt;
423+
</pre>
424+
425+
If we assume a [=fictional tag sequence=]
426+
to represent the elements’ ''::first-letter'' pseudo-elements,
427+
it would be something like:
428+
429+
<pre>
430+
&lt;div&gt;
431+
&lt;p&gt;&lt;span&gt;&lt;div::first-letter&gt;&lt;p::first-letter&gt;<strong>&lt;div::first-letter::prefix&gt;&lt;p::first-letter::prefix&gt;</strong><strong>&lt;/&hellip;&gt;&lt;/&hellip;&gt;</strong>T&lt;/&hellip;&gt;&lt;/&hellip;&gt;he first few words&lt;/span>
432+
and the rest of the paragraph.
433+
&lt;/div&gt;
434+
</pre>
435+
</div>
436+
398437
If the characters that would form the [=first-letter text=]
399438
are not all in the same element
400439
(as the <code>‘T</code> in <code class="lang-css">&lt;p&gt;‘&lt;em&gt;T...</code>),
401-
the user agent may create a ''::first-letter'' pseudo-element
440+
the user agent may create the ''::first-letter'' pseudo-element
441+
(and its ''::prefix'' or ''::postfix'' sub-elements, if any)
402442
from one of the elements, or all elements,
403-
or simply not create a pseudo-element.
443+
or simply not create the pseudo-element(s).
404444
Additionally, if the [=first-letter text=]
405445
is not at the start of the line
406446
(for example due to bidirectional reordering,
@@ -413,10 +453,14 @@ Inheritance and Box Tree Structure of the ''::first-letter'' Pseudo-element</h4>
413453
the same as any [=inline box=] on the same line.
414454

415455
<h4 id="first-letter-styling">
416-
Styling the ''::first-letter'' Pseudo-element</h4>
456+
Styling the First-Letter Pseudo-elements</h4>
417457

418-
In CSS a ::first-letter pseudo-element is similar to an [=inline box=].
419-
The following properties that apply to ''::first-letter'' pseudo-elements:
458+
In CSS a ''::first-letter'' [=pseudo-element=]
459+
(and its ''::prefix'' and ''::postfix'' sub-elements)
460+
is similar to an [=inline box=].
461+
The following properties that apply to
462+
''::first-letter'', ''::first-letter::prefix'', and ''::first-letter::postfix''
463+
pseudo-elements:
420464

421465
<ul>
422466
<li>all font properties (see [[CSS-FONTS-3]])
@@ -922,6 +966,8 @@ List Markers: the ''::marker'' pseudo-element</h3>
922966
and the computed value of 'display' on ''::marker''
923967
always loses any ''display/list-item'' aspect.
924968

969+
ISSUE: Should ''::marker'' also have ''::prefix'' and ''::postfix'' sub-elements?
970+
925971
<h3 id="placeholder-pseudo">
926972
Placeholder Input: the ''::placeholder'' pseudo-element</h3>
927973

0 commit comments

Comments
 (0)