绝对定位的应用以及实现layui-container的效果

104 阅读1分钟

效果图:

image.png

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .banner{
            height: 320px;
            background: url(./so-banner.jpg) no-repeat center center;
            color: #002e60;
        }
        .banner-content{
            width: 1170px;
            position: relative;
            margin: 0 auto;
            padding: 0 15px;
            box-sizing: border-box;
        }
        .banner-content h3{
            text-align: center;
            color: #002e60;
            padding: 50px 0 20px 0;
            font-size: 24px;
        }
        .banner-content p{
            text-align: center;
            color: #002e60;
            margin: 20px 0 40px 0;
            font-size: 18px;
        }
        .banner-type{
            display: flex;
            align-items: center;
        }
        .banner-type .item{
            position: relative;
            width: 25%;
            padding-top: 40px;
            text-align: center;
        }
        .banner-type .item a{
            font-size: 18px;
            color: #333;
            text-decoration: none;
            text-align: center;
        }
        .banner-type .item .border{
            border-top: 1px solid #002e60;
            position: absolute;
            top: 0;
            width: 100%;
        }
        .banner-type .item .tiao{
            position: absolute;
            top: 0;
            left: 50%;
            height: 30px;
            border-left: 1px solid #002e60;
        }
        .banner-type .item .boOne{
            width: 50%;
            right: 0;
        }
        .banner-type .item  .bolast{
            width: 50%;
            left: 0;
        }
    </style>
</head>
<body>
    <div class="banner">
        <div class="banner-content">
            <h3>行业及解决方案</h3>
            <p>为移动物流的装备/安全/状态等提供具体的解决方案</p>
            <div class="banner-type">
                <div class="item">
                    <div class="border boOne"></div>
                    <div class="tiao"></div>
                    <a href="nyhg.html">能源与化工</a>
                </div>
                <div class="item">
                    <div class="border"></div>
                    <div class="tiao"></div>
                    <a href="nyhg.html">能源与化工</a>
                </div>
                <div class="item">
                    <div class="border"></div>
                    <div class="tiao"></div>
                    <a href="nyhg.html">能源与化工</a>
                </div>
                <div class="item">
                    <div class="border bolast"></div>
                    <div class="tiao"></div>
                    <a href="nyhg.html">能源与化工</a>
                </div>
                
            </div>
        </div>
    </div>
</body>
</html>