flex布局

前端之家收集整理的这篇文章主要介绍了flex布局前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>标题</title>
    <style type="text/css"> .grid{display: flex;flex-wrap:wrap;justify-content:space-around;} .grid-cell{flex-grow:1;flex-shrink:1;padding: 10px;} .demo{background-color: #eeeeee;min-height: 50px;text-align: center;width: 100%} </style>
</head>
<body>
    <div class="grid">
        <div class="grid-cell">
            <div class="demo">1</div>
        </div>
        <div class="grid-cell">
            <div class="demo">
                2
            </div>
        </div>
    </div>
    <div class="grid">
        <div class="grid-cell">
            <div class="demo">1</div>
        </div>
        <div class="grid-cell">
            <div class="demo">2</div>
        </div>
        <div class="grid-cell">
            <div class="demo">3</div>
        </div>
    </div>
    <div class="grid">
        <div class="grid-cell">
            <div class="demo">1</div>
        </div>
        <div class="grid-cell">
            <div class="demo">2</div>
        </div>
        <div class="grid-cell">
            <div class="demo">3</div>
        </div>
        <div class="grid-cell">
            <div class="demo">4</div>
        </div>
    </div>
</body>
</html>

这里写图片描述


这里写图片描述

猜你在找的Flex相关文章