【发布时间】:2021-12-03 07:15:27
【问题描述】:
示例: https://flowster.app/flowster-affiliate-program-activation-bonus/
您可以看到黄色下划线(突出显示)仅使其达到“A”,但它应该位于“Flowster Affiliate Program”下方:
但是,HTML 看起来像这样:
<h1 class="elementor-heading-title elementor-size-default">
<span class="yellowhighlight">Flowster Affiliate Program</span> -
Activation Bonus
</h1>
yellowhighlight CSS 类看起来像:
span.yellowhighlight {
position: relative;
z-index: 0;
}
span.yellowhighlight::after {
content: "";
position: absolute;
left: -0.15em;
right: -0.15em;
top: 0.8em;
height: 0.4em;
border-radius: 2em;
background: #fffa50;
z-index: -1;
}
这很奇怪,因为在其他页面上它看起来很正常。
span.yellowhighlight {
position: relative;
z-index: 0;
}
span.yellowhighlight::after {
content: "";
position: absolute;
left: -0.15em;
right: -0.15em;
top: 0.8em;
height: 0.4em;
border-radius: 2em;
background: #fffa50;
z-index: -1;
}
<h1 class="elementor-heading-title elementor-size-default">
<span class="yellowhighlight">Flowster Affiliate Program</span> -
Activation Bonus
</h1>
【问题讨论】:
-
将 display:inline-block 添加到 span
-
@TemaniAfif 我们已经在许多页面中使用这些跨度,所以这不是一个好的选择。希望有办法更新类 CSS?
-
拆分成三个
span,每个span一个字。 -
@ЖнецЪ 这不是一个好的长期解决方案。这需要非技术人员可用于任何页面上的任何文本。试图向他们解释他们需要为每个单词使用跨度会很困难。
标签: html css background-color elementor