Here's a reproduced example:
div.addu { color: #006e28; text-decoration: underline; }
div.addu blockquote pre { text-decoration: none; }
div.addu blockquote pre code { text-decoration: none; }
div.addu pre, div.rm pre, div.add pre { background-color: #f6f8fa; }
div.addu > blockquote {
border-left: 4px solid #00a000;
padding: 0 15px;
color: #006e28;
text-decoration: none;
}
<div class="addu">
<pre><code>Underline this code</code></pre>
<p><em>Effects</em>: Equivalent to:</p>
<blockquote>
<pre><code>Do not
Underline
This code</code></pre>
</blockquote>
</div>
The early underlined code looks great. The blockquote with the left border looks great. But why is the inner code still underlined? Why doesn't the text-decoration:none; apply to it? As you can see, I tried to add that in lots of different places, but the top-level underline seems to persist. How do I do this right?
You can use > selector of css to achieve this,
No need to change HTML or add a class
text-decoration from div.addupre tag using > selector and give text-decoration: underline to ittext-decoration: underline; to p tagdiv.addu { color: #006e28; }
div.addu p { text-decoration: underline; }
div.addu > pre { text-decoration: underline; }
div.addu blockquote pre { text-decoration: none; }
div.addu blockquote pre code { text-decoration: none; }
div.addu pre, div.rm pre, div.add pre { background-color: #f6f8fa; }
div.addu > blockquote {
border-left: 4px solid #00a000;
padding: 0 15px;
color: #006e28;
text-decoration: none;
}
<div class="addu">
<pre>
<code>strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept;</code>
</pre>
<p>
<span class="marginalizedparent"><a class="marginalized">8</a></span>
<em>Effects</em>: Equivalent to:
</p>
<blockquote>
<pre>
<code>if (auto c = lhs.category() <=> rhs.category(); c != 0) return c;
return lhs.value() <=> rhs.value();</code>
</pre>
</blockquote>
<pre>
<code>strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept;</code>
</pre>
<p>
<span class="marginalizedparent"><a class="marginalized">9</a></span>
<em>Effects</em>: Equivalent to:
</p>
<blockquote>
<pre>
<code>if (auto c = lhs.category() <=> rhs.category(); c != 0) return c;
return lhs.value() <=> rhs.value();</code>
</pre>
</blockquote>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With