当前位置:主页 > 查看内容

css实现文字居中两边横线效果的示例代码

发布时间:2021-07-01 00:00| 位朋友查看

简介:本文介绍了css实现文字居中两边横线效果的示例代码,分享给大家,具体笔记如下: 效果: !doctype htmlhtml lang=enhead meta charset=UTF-8 meta name=viewport content=width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, mini……

本文介绍了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>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。


原文链接:https://m.jb51.net/css/651319.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐