这个问题在这里已有答案:
当我去多线时,我遇到了带标题的问题。它将比文本可见区域更大。
我怎么能这样做?
.heading-bordered {
font-size: 32px;
margin: 20px;
width: 350px;
text-align: center;
position: relative;
}
.heading-bordered span {
display: inline-block;
position: relative;
padding-bottom: 10px;
}
.heading-bordered span:before{
height: 2px;
background: #333;
content: '';
position: absolute;
left: 0;
right: 0;
top: 100%;
}
<div class="heading-bordered">
<span>This is so long heading and so long....</span>
</div>
试试这个
.heading-bordered span:before {
height: 2px;
background: #333;
content: '';
position: absolute;
left: 25px;
right: 25px;
top: 100%;
}