Skip to content

Commit 24bb20a

Browse files
litherumfantasai
andauthored
[css-text-decor-3] [css-text-decor-4] Add example describing how decorating box interacts with text-shadow (#7588)
* [css-text-decor-3] [css-text-decor-4] Add example describing how decorating box interacts with text-shadow Thanks to Alan Bujtas for the example and research! * Apply suggestions from code review Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: fantasai <fantasai.bugs@inkedblade.net>
1 parent ba0b463 commit 24bb20a

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

css-text-decor-3/Overview.bs

+19
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,25 @@ Line Decoration: Underline, Overline, and Strike-Through</h2>
216216
represents the span element, and the orange lines represent the
217217
blocks.
218218
</div>
219+
<div class="example">
220+
In the following style sheet and document fragment:
221+
<pre>
222+
div { color: black; font-size: 48px; text-decoration: underline; text-shadow: blue 0px 50px 0px; }
223+
span { font-size: 20px; vertical-align: top; text-shadow: green 0px 100px 0px; }
224+
</pre>
225+
<pre>
226+
&lt;div&gt;Help, help! &lt;span&gt;I am under a hat!&lt;/span&gt;&lt;/div&gt;
227+
</pre>
228+
...the &lt;div&gt; is the [=decorating box=] for its underline (in black),
229+
which is rendered uninterrupted through both the &lt;div&gt; and the &lt;span&gt;.
230+
Unlike line decorations, however,
231+
`text-shadow` is inherited as a property;
232+
therefore the green text shadow on the &lt;span&gt;
233+
overrides the blue text shadow on the &lt;div&gt;.
234+
As a result, when the shadows are painted,
235+
the shadow of the &lt;div&gt;’s underline is disjoint across the two elements.
236+
<img src="images/underline-example-2.png" alt="Sample rendering of the above underline example">
237+
</div>
219238

220239
Note: Line decorations are propagated through the box tree,
221240
not through inheritance,
18.1 KB
Loading

css-text-decor-4/Overview.bs

+19
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,25 @@ Line Decoration: Underline, Overline, and Strike-Through</h2>
160160
represents the span element, and the orange lines represent the
161161
blocks.
162162
</div>
163+
<div class="example">
164+
In the following style sheet and document fragment:
165+
<pre>
166+
div { color: black; font-size: 48px; text-decoration: underline; text-shadow: blue 0px 50px 0px; }
167+
span { font-size: 20px; vertical-align: top; text-shadow: green 0px 100px 0px; }
168+
</pre>
169+
<pre>
170+
&lt;div&gt;Help, help! &lt;span&gt;I am under a hat!&lt;/span&gt;&lt;/div&gt;
171+
</pre>
172+
...the &lt;div&gt; is the [=decorating box=] for its underline (in black),
173+
which is rendered uninterrupted through both the &lt;div&gt; and the &lt;span&gt;.
174+
Unlike line decorations, however,
175+
`text-shadow` is inherited as a property;
176+
therefore the green text shadow on the &lt;span&gt;
177+
overrides the blue text shadow on the &lt;div&gt;.
178+
As a result, when the shadows are painted,
179+
the shadow of the &lt;div&gt;’s underline is disjoint across the two elements.
180+
<img src="images/underline-example-2.png" alt="Sample rendering of the above underline example">
181+
</div>
163182

164183
Note: Line decorations are propagated through the box tree,
165184
not through inheritance,
18.1 KB
Loading

0 commit comments

Comments
 (0)