Skip to content

Commit 81dc333

Browse files
committed
[css-text-decor-4] Replace text-decoration-skip-edges with text-decoration-trim. #4557
1 parent 8dc1094 commit 81dc333

File tree

1 file changed

+68
-51
lines changed

1 file changed

+68
-51
lines changed

css-text-decor-4/Overview.bs

+68-51
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,74 @@ Text Decoration Line Uniformity</h3>
843843
-->
844844
</div>
845845

846+
847+
<h4 id="text-decoration-skip-inset-property">
848+
Text Decoration Line Trimming and Extension: the 'text-decoration-trim' property</h4>
849+
850+
<pre class="propdef">
851+
Name: text-decoration-trim
852+
Value: <<length>>{1,2} | auto
853+
Initial: 0
854+
Applies to: all elements
855+
Inherited: no
856+
Percentages: N/A
857+
Computed value: specified keyword or absolute length
858+
Animation type: by computed value
859+
</pre>
860+
861+
This property adjusts the start and end points of line decorations,
862+
allowing the author to shorten, lengthen, or shift the decoration
863+
with respect to the text.
864+
It controls all text decoration lines drawn by this [=decorating box=],
865+
but not any text decoration lines drawn by its ancestors.
866+
If two component values are given,
867+
the first applies to the [=start=] and the second to the [=end=].
868+
Values have the following meanings:
869+
870+
<dl dfn-type=value dfn-for=text-decoration-skip-inset>
871+
<dt><dfn><<length>></dfn></dt>
872+
<dd>
873+
Inset (positive) or outset (negative)
874+
the start/end of the affected line decorations.
875+
876+
<div class="example">
877+
<p>The following example offsets an extra thick underline
878+
1em endwards with respect to the text
879+
<pre>
880+
h1 {
881+
text-decoration: underline 0.3em rgba(36,148,187,0.25);
882+
text-decoration-trim: 1em -1em;
883+
}
884+
</pre>
885+
</div>
886+
887+
<dt><dfn>auto</dfn></dt>
888+
<dd>
889+
The UA chooses a trim amount that ensures that
890+
if two identical underlined elements appear side-by-side
891+
they do not appear to have a single underline.
892+
(This is important in Chinese, where underlining is a form of punctuation.)
893+
894+
<div class="figure">
895+
<p><img title="text-decoration-skip-inset: auto"
896+
alt="An underline below a series of Chinese characters has a gap between two adjacent underlining elements."
897+
src="images/decoration-skip-inset.png">
898+
<p class="caption">''text-decoration-skip-inset: auto'' for <code>&lt;u>石井&lt;/u>&lt;u>艾俐俐&lt;/u></code>
899+
</p>
900+
</div>
901+
</dl>
902+
903+
Text decoration trimming is subject to 'box-decoration-break':
904+
* for ''box-decoration-break/slice'' (the default)
905+
trimming is only applied to the [=start=] edge of the first fragment
906+
and the [=end=] edge of the last fragment,
907+
and may accumulate to other fragments if the amount of the trim
908+
is more than the length of the fragment.
909+
Percentages are relative to the total length of the [=decorating box=].
910+
* for ''box-decoration-break/clone''
911+
trimming is applied to each fragment independently.
912+
<!-- and percentages are relative to the length of that fragment individually -->
913+
846914
<h3 id="text-decoration-skipping">
847915
Text Decoration Line Continuity: the 'text-decoration-skip' shorthand and its sub-properties</h3>
848916

@@ -971,57 +1039,6 @@ Skipping Spaces: the 'text-decoration-skip-box' property</h4>
9711039
a <a>decorating box</a> never draws over its own box decoration.
9721040
</dl>
9731041

974-
<h4 id="text-decoration-skip-inset-property">
975-
Inset Edges: the 'text-decoration-skip-inset' property</h4>
976-
977-
<pre class="propdef">
978-
Name: text-decoration-skip-inset
979-
Value: none | auto
980-
Initial: none
981-
Applies to: all elements
982-
Inherited: yes
983-
Percentages: N/A
984-
Computed value: specified keyword(s)
985-
Animation type: discrete
986-
</pre>
987-
988-
Issue: The CSSWG resolved to split 'text-decoration-skip' into sub-properties,
989-
but this value set has not yet been vetted by the CSSWG.
990-
991-
This property specifies what parts of the element's box area
992-
any text decoration affecting the element must skip over.
993-
It controls all text decoration lines drawn by the element,
994-
but not any text decoration lines drawn by its ancestors.
995-
Values have the following meanings:</p>
996-
997-
<dl dfn-type=value dfn-for=text-decoration-skip-inset>
998-
<dt><dfn>none</dfn></dt>
999-
<dd>
1000-
Skip nothing: text-decoration is drawn from box edge to box edge.
1001-
1002-
<dt><dfn>auto</dfn></dt>
1003-
<dd>
1004-
The UA must place the start and end of the line inwards slightly
1005-
from the content edge of the <a>decorating box</a> so that,
1006-
e.g. two underlined elements side-by-side do not appear to have a single underline.
1007-
The size of the inset is up to the user agent
1008-
(e.g. half a line thickness)
1009-
but must not be zero.
1010-
(This is important in Chinese, where underlining is a form of punctuation.)
1011-
1012-
<div class="figure">
1013-
<p><img title="text-decoration-skip-inset: auto"
1014-
alt="An underline below a series of Chinese characters has a gap between two adjacent underlining elements."
1015-
src="images/decoration-skip-inset.png">
1016-
<p class="caption">''text-decoration-skip-inset: auto'' for <code>&lt;u>石井&lt;/u>&lt;u>艾俐俐&lt;/u></code>
1017-
</p>
1018-
</div>
1019-
</dl>
1020-
1021-
ISSUE: This might want to be a standalone property rather than part of the 'text-decoration-skip' set.
1022-
See also <a href="https://github.com/w3c/csswg-drafts/issues/4557">Issue 4557</a>,
1023-
about controlling the line length explicitly.
1024-
10251042
<h4 id="text-decoration-skip-spaces-property">
10261043
Skipping Spaces: the 'text-decoration-skip-spaces' property</h4>
10271044

0 commit comments

Comments
 (0)