Skip to content
鼓励作者:欢迎打赏犒劳

01-flex布局

阮一峰教程:https://www.ruanyifeng.com/blog/2015/07/flex-grammar.html

平分布局

html
<view class="container">
    <view class="view">1</view>
    <view class="view">2</view>
    <view class="view">3</view>
    <view class="view">4</view>
</view>


.container {
    display: flex;
    /*从左到右排列*/
    flex-direction: row;
    /*对齐方式*/
    justify-content: space-between;
    /*换行*/
    flex-wrap: wrap;
}

.view {
    height: 100px;
    margin: 5px;
    /*因为有margin所以要减去10px*/
    width: calc(50% - 10px);
    background-color: #2600ff;
}

box-shadow

如有转载或 CV 的请标注本站原文地址