扫码关注官方订阅号
类似这样
欢迎选择我的课程,让我们一起见证您的进步~~
试试下面这个,看看是不是你想要的
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .title{ text-align: center; overflow: hidden; } .title span{ position: relative; display: inline-block; } .title span::before{ content: ''; position: absolute; top: 50%; width: 1000px; height: 1px; left: 100%; background-color: #333; } .title span::after{ content: ''; position: absolute; top: 50%; right: 100%; width: 1000px; height: 1px; background-color: #333; } </style> </head> <body> <p class="title"><span>测试文字</span></p> </body> </html>
这时候就是推广文章的时候,请看这里,详细介绍:
CSS实现删除线贯穿中线效果
除了上面的方法,还有个自己以前琢磨出来的办法。
<p class="text-box"> <span class="text">文字文字</span> </p> <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>
https://jsfiddle.net/67n5dcod/1/
直接上代码:html部分:
<p class="bottom-line"></p> <p class="time"></p>
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; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
试试下面这个,看看是不是你想要的
这时候就是推广文章的时候,请看这里,详细介绍:
CSS实现删除线贯穿中线效果
除了上面的方法,还有个自己以前琢磨出来的办法。
https://jsfiddle.net/67n5dcod/1/
直接上代码:
html部分:
css部分: