::before,::after写标题两端横线样式

完成图如下
::before,::after写标题两端横线样式_第1张图片
代码如下

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入jquery -->
    <script src="../../static/jq/jquery.min.js"></script>
    <!-- 引入swiper -->
    <script src="../../static/swiper/swiper.min.js"></script>
    <link rel="stylesheet" href="../../static/swiper/swiper.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        .culture {
            background: #eefaec;
            padding: 50px;
        }
        /* 标题部分 */
        
        .title {
            font-weight: 600;
            letter-spacing: 2px;
            color: #444444 !important;
            text-align: center;
        }
        
        .heng {
            padding-top: 5px !important;
            text-align: center;
        }
        
        .heng span {
            position: relative;
            padding: 0 20px;
            color: #969696;
        }
        
        .heng span:before {
            right: 100%;
        }
        
        .heng span:after,
        .heng span:before {
            content: '';
            position: absolute;
            top: 50%;
            width: 130px;
            height: 1px;
            background-color: #969696;
        }
        
        .heng span:after {
            left: 100%;
        }
        
        .heng span:after,
        .heng span:before {
            content: '';
            position: absolute;
            top: 50%;
            width: 130px;
            height: 1px;
            background-color: #969696;
        }
        
        @media (max-width: 769px) {
            .culture {
                padding: 20px;
            }
            .culture>div.container {
                margin-top: 20px;
                padding: 15px;
            }
        }
    </style>
</head>

<body>

    <!-- 第一种 -->
    <div class="culture">

        <div class="text-center fs-26 fs-sm-28 text-success wow fadeInDown title" style="visibility: visible; animation-name: fadeInDown;">企业文化</div>
        <div class="text-center fs-14 fs-sm-16 mb-4 text-secondary wow fadeInUp heng" data-wow-delay="1s" style="visibility: visible; animation-delay: 1s; animation-name: fadeInUp;">
            <span>CORPORATE CULTURE</span>
        </div>

    </div>
</body>
<script>
</script>

</html>

你可能感兴趣的:(::before,::after写标题两端横线样式)