【发布时间】:2020-03-05 10:52:41
【问题描述】:
我正在尝试为标签添加边框。边框应该每次都应用或应用于文本。
这是设计。
这是我到目前为止的代码。
h2 {
position:relative;
}
h2 strong:after {
content: "";
position:absolute;
border-bottom: 5px solid red;
height: 10px;
width:100%;
bottom: 0;
display: inline-block;
}
<h2>
Pellentesque in <strong>ipsum</strong> id orci porta dapibus. Donec rutrum congue leo eget malesuada.
</h2>
非常感谢任何帮助。
谢谢。
【问题讨论】:
-
你的宽度是 100%。这就是为什么边框在文本之后继续的原因