美文网首页
-webkit-box(弹性盒子)

-webkit-box(弹性盒子)

作者: 回不去的那些时光 | 来源:发表于2018-11-26 21:38 被阅读5次

html

<ul class="list">
    <li>111111111111111111111111</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li> 
</ul>

css

* {
    margin: 0;
    padding: 0;
    list-style: none;
}
.list {
    /* 弹性布局 */
    display: -webkit-box;
     /*
        -webkit-box-orient: 排列方式     默认为水平
            horizontal 水平
            vertical 垂直
    */
    -webkit-box-orient: vertical;
    /*
        -webkit-box-pack: 水平对其方式
            center| start| end| justify
    */
    -webkit-box-pack: justify;
        /*
        -webkit-box-align: 垂直对其方式
            center| start| end| baseline
    */
    -webkit-box-align: center;
}
.list li {
    /* 均分剩余宽度 */
    /*-webkit-box-flex: 1;*/
}
.list li:nth-child(1) {
    background-color: #ccc;
}
.list li:nth-child(2) {
    background-color: red;
}
.list li:nth-child(3) {
    background-color: yellow;
}
.list li:nth-child(4) {
    background-color: blue;
}
.list li:nth-child(5) {
    background-color: green;
}

相关文章

网友评论

      本文标题:-webkit-box(弹性盒子)

      本文链接:https://www.haomeiwen.com/subject/lxbiqqtx.html