css实现文字居中两边横线效果
效果:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .title{ text-align: center; position: relative; height: 50px; line-height: 50px; width: 800px; margin: 200px auto; } .title:after,.title:before{ content: ""; position: absolute; top: 50%; background: #7a7a7a; height: 1px; width: 35%; } .title:after{ left: 0; } .title:before{ right: 0; } </style> </head> <body> <div class="title">css实现文字居中两边横线效果</div> </body> </html>
相关推荐
HSdiana 2020-03-28
多读书读好书 2020-11-03
drdrsky 2020-06-16
gufudhn 2020-06-12
aSuncat 2020-06-11
PioneerFan 2020-06-10
沈宫新 2020-05-04
swiftwwj 2020-03-28
葉無聞 2020-03-23
lyg0 2020-03-07
nercon 2020-02-22
STPace 2020-02-17
STPace 2019-12-30
冰蝶 2020-01-10
玫瑰小妖 2019-12-31
爱好HtmlCssJs 2019-12-31
行吟阁 2019-12-08