类似这样
除了上面的方法,还有个自己以前琢磨出来的办法。
<div class="text-box">
<span class="text">文字文字</span>
</div>
<style>
.text-box {
display:table;
width:100%;
}
.text {
display:table-cell;
width: 90px;
text-align: center;
position:relative;
bottom:-4px;
}
.text-box::before,.text-box::after {
content:"";
display:table-cell;
border-bottom:#ccc solid 1px;
}
</style>
直接上代码:
html部分:
<div class="bottom-line"></div>
<div class="time"></div>
css部分:
.bottom-line{
position: relative;
width: 27.6rem;
height: 1px;
background-color: #E6E6E6;
margin: 3rem auto 0
}
.time{
position: relative;
color: #999999;
width: 10rem;
margin: -0.5rem auto 0;
z-index: 5;
text-align: center;
background-color: #fff;
}
13 回答12.8k 阅读
7 回答1.9k 阅读
3 回答1.1k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答862 阅读✓ 已解决
6 回答881 阅读✓ 已解决
4 回答956 阅读✓ 已解决
试试下面这个,看看是不是你想要的