Skip to content

Commit 512adad

Browse files
authored
[css-text-decor-4] Added percentages to text-decoration-inset (#14282)
Resolution: #8403 (comment)
1 parent 8dc970b commit 512adad

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

css-text-decor-4/Overview.bs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -867,11 +867,12 @@ Trimming, Expanding, and Shifting Text Decoration Lines: the 'text-decoration-in
867867

868868
<pre class="propdef">
869869
Name: text-decoration-inset
870-
Value: <<length>>{1,2} | auto
870+
Value: <<length-percentage>>{1,2} | auto
871871
Initial: 0
872872
Applies to: all elements
873873
Inherited: no
874-
Percentages: N/A
874+
Percentages: Depending on the value of 'box-decoration-break',
875+
either refer to the inline size of the [=decorating box=] or of each individual [=box fragment=]
875876
Computed value: specified keyword or absolute length
876877
Animation type: by computed value
877878
</pre>
@@ -887,23 +888,51 @@ Trimming, Expanding, and Shifting Text Decoration Lines: the 'text-decoration-in
887888
Values have the following meanings:
888889

889890
<dl dfn-type=value dfn-for=text-decoration-inset>
890-
<dt><dfn><<length>></dfn></dt>
891+
<dt><dfn><<length-percentage>></dfn></dt>
891892
<dd>
892893
Adjusts the start or end endpoint of the affected line decorations.
893894
Positive values move the endpoint inward (trimming),
894895
negative values move it outward (extending).
895896

897+
Percentage values either refer to the total inline size of the [=decorating box=],
898+
if 'box-decoration-break' is set to ''box-decoration-break/slice'',
899+
or to the inline size of each individual [=box fragment=],
900+
if it is set to ''box-decoration-break/clone''.
901+
896902
<div class="example">
897903
<p>The following example offsets an extra thick underline
898904
1em endwards with respect to the text
899905
<pre>
900906
h1 {
901-
text-decoration: underline 0.3em rgba(36,148,187,0.25);
907+
text-decoration: underline 0.3em rgb(36 148 187 / 0.25);
902908
text-decoration-inset: 1em -1em;
903909
}
904910
</pre>
905911
</div>
906912

913+
<div class="example">
914+
<p>In this example, the underline is inset 10% of the inline size of the [=decorating box=]
915+
from the start and end of it.
916+
<pre>
917+
h1 {
918+
text-decoration: underline 0.3em rgb(36 148 187 / 0.25);
919+
text-decoration-inset: 10%;
920+
}
921+
</pre>
922+
</div>
923+
924+
<div class="example">
925+
<p>In this example, the underline is inset 5% of the inline size of each [=box fragment=]
926+
from the end of that fragment.
927+
<pre>
928+
h1 {
929+
text-decoration: underline 0.3em rgb(36 148 187 / 0.25);
930+
text-decoration-inset: 0 5%;
931+
box-decoration-break: clone;
932+
}
933+
</pre>
934+
</div>
935+
907936
<dt><dfn>auto</dfn></dt>
908937
<dd>
909938
The UA chooses an inset amount that ensures that

0 commit comments

Comments
 (0)