【发布时间】:2021-02-14 05:01:47
【问题描述】:
【问题讨论】:
标签: css
【问题讨论】:
标签: css
你可以这样做
.underline span {
display: inline-block;
background-position-y: -0%;
background-image: linear-gradient( transparent 50%, #0095ff 50%);
transition: background .3s ease;
background-size: 2px;
background-size: auto 175%;
text-decoration: none;
font-weight: 600;
}
<p class="underline">
This sentence has <span>Highlighted Text</span> in the middle.
</p>
【讨论】:
我会使用 ::after 伪元素来突出显示。 这是一个例子:
.highlight {
position: relative;
}
.highlight::after {
content: " ";
left: 0;
right: 0;
position: absolute;
bottom: 1px;
height: 6px;
background-color: #9bffb0a6;
z-index: -1;
}
<div><span class="highlight">Cloud Native</span>: Cloud Training, Cloud Development, Cloud Architecture, Cloud Assesment....</div>
只要 .highlight 类用于您想要突出显示的任何文本。
【讨论】: