Skip to content

Commit 73a443f

Browse files
committed
[css-pseudo-4] Clarify painting order of highlight text decoration, allow ::selection stacked at the top. w3c#6022
1 parent 0f7ab93 commit 73a443f

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

css-pseudo-4/Overview.bs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,42 @@ Text and Text Decorations</h4>
928928
are stacked in the same order as their backgrounds
929929
over the text’s original decorations
930930
and are all drawn, each decoration in its own color.
931+
The normal painting order applies,
932+
so as per <a href="https://www.w3.org/TR/CSS2/zindex.html#painting-order">CSS2 Appendix E</a>,
933+
all underlines are drawn
934+
below overlines which are drawn
935+
below the text which is drawn
936+
below any line-throughs.
937+
However, text decorations applied by ''::selection''
938+
may instead all be drawn
939+
along with the text
940+
as a topmost set of layers
941+
above all other decorations.
942+
943+
<div class="example">
944+
For example, assuming the original text has an underline and a strike-through,
945+
that ''::selection'' applies an underline
946+
and ''::target-text'' appplies both overline and strike-through,
947+
the following are both conformant painting orders:
948+
<div style="columns: 20em">
949+
<ol style="break-inside: avoid; margin-top: 0;">
950+
<li>original underline
951+
<li>''::selection'' underline
952+
<li>''::target-text'' overline
953+
<li>''::selection''-colored text
954+
<li>original strike-through
955+
<li>''::target-text'' strike-through
956+
</ol>
957+
<ol style="break-inside: avoid; margin-top: 0;">
958+
<li>original underline
959+
<li>''::target-text'' overline
960+
<li>original strike-through
961+
<li>''::target-text'' strike-through
962+
<li>''::selection'' underline
963+
<li>''::selection''-colored text
964+
</ol>
965+
</div>
966+
</div>
931967

932968
<h4 id="highlight-replaced">
933969
Replaced Elements</h4>

0 commit comments

Comments
 (0)