flex布局

博客分类: 笔记 阅读次数: comments

flex布局

flex 布局(弹性盒子布局)

容器属性:

<style>
        .header {
            display: flex;
            flex-direction: row;//或column/或row-reserve/或column-reserve
            background: rgb(243, 231, 231);
        }
        .box {
            border: 1px solid rgb(61, 58, 58);
            background: rgb(132, 205, 207);
            width: 100px;
            height: 100px;
        }
    </style>

row:

row-server:

column:

column-server:

.header {
            width: 300px;
            height: 300px;
            display: flex;
            flex-direction: row;//或column/或row-reserve/或column-reserve
            flex-wrap: wrap;//或nowrap/或wrap-reverse
            background: rgb(243, 231, 231);
        }

wrap:

nowrap:

wrap-reserve:

元素属性:

auto (有设置 width 按照 width 来,没有则按照内容来撑)