我遇到多行时带标题的问题。它将比文本可见区域更大。
我怎样才能达到这个目的?
.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>
答案 0 :(得分:-2)
试试这个
.heading-bordered span:before {
height: 2px;
background: #333;
content: '';
position: absolute;
left: 25px;
right: 25px;
top: 100%;
}