关于css3:flex实现左右均分布局带固定间距

47次阅读

共计 666 个字符,预计需要花费 2 分钟才能阅读完成。

1. 间接上代码

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

    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
        <style>
            body,
            p {margin: 0;}
            
            .parent {display: flex;}
            
            .child {
                flex: 1;
                height: 100px;
            }
            
            .child {margin-right: 14px;}
            
            .child:last-child {margin-right: 0;}
        </style>
    </head>

    <body>
        <div class="parent" style="background-color: #ffff;">
            <div class="child" style="background-color: #1180FD;"></div>
            <div class="child" style="background-color: #1180FD;"></div>
            <div class="child" style="background-color: #1180FD;"></div>
            <div class="child" style="background-color: #1180FD;"></div>
        </div>
    </body>

</html>

2. 成果展现

正文完
 0