^ 类似的东西 - 它使用 :after 吗? (无法对多行执行此操作)
.home-about h3:after{
margin-top:-15px;
content: " ";
background:#d7edf4;
z-index: 0;
}
最佳答案
是的,您可以使用伪元素。这是一种绝对定位在 h3 中且具有负 z-index 的方法。
h3 {
position: relative;
display: inline-block;
}
h3:after {
content: " ";
background: #d7edf4;
z-index: -1;
display: block;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: .4em;
}
<h3>text</h3>
关于css - 如何在 css 中制作自定义高亮显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43622673/