首页 > 其他 > 详细

弹性布局

时间:2021-05-02 21:59:05      阅读:24      评论:0      收藏:0      [点我收藏+]
<!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>
</head>
<style>
    .box{
        width: 400px;
        height: 300px;
        border: solid 1px springgreen;
        /* 设置弹性容器 */
        display:flex;
        /* 横向反向排列,等同于 有浮动   */
        /* flex-direction: row-reverse; */
        /* 竖着排列 反向排列,*/
        /* flex-direction: column-reverse; */
        /* 成不开换行 */
        flex-wrap:wrap;
        /* 换行反向排列 */
        /* flex-wrap:wrap-reverse */
        /* 靠右边 */
        /* justify-content: flex-end; */
        /* 剧中 */
        /* justify-content: center; */
        /* 最外侧两边的距离加起来等于 两个元素的距离 */
        /* justify-content: space-around; */
        /* 元素之间等距离 */
        /* justify-content: space-evenly; */
        /* 竖着排列靠下 */
        /* align-content: flex-end; */
        /* 需要设置成(撑不开换行)才能生效*/
        align-content: center;
    }
    .box div{
        width: 50px;
        height: 50px;
        border: 1px solid steelblue;


    }
</style>
<body>
    <div class="box">
        <div>第一个盒子</div>
        <div>第2个盒子</div>
        <div>第3个盒子</div>
        <div>第4个盒子</div>
    </div>
</body>
</html>

弹性布局

原文:https://www.cnblogs.com/xkyy/p/14726105.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!