默认的flex

CSS Flex印象(1)文章代码示例一

by lyplba

HTML

<div class="flex-wrapper">
    <div class="flex-item">1</div>
    <div class="flex-item">2</div>
    <div class="flex-item">3</div>
    <div class="flex-item">4</div>
    <div class="flex-item">5</div>
    <div class="flex-item">6</div>
    <div class="flex-item">7</div>
    <div class="flex-item">8</div>
    <div class="flex-item">9</div>
</div>

CSS

.flex-wrapper {
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flex;
    display: -o-flex;
    display: flex;
}
.flex-item {
    height: 36px;
    font-size: 18px;
    line-height: 36px;
    color: #fff;
    text-align: center;
}
.flex-item:nth-of-type(1) { background-color: #82c12f; }
.flex-item:nth-of-type(2) { background-color: #bddb63; }
.flex-item:nth-of-type(3) { background-color: #fd7923; }
.flex-item:nth-of-type(4) { background-color: #f9b271; }
.flex-item:nth-of-type(5) { background-color: #b11a21; }
.flex-item:nth-of-type(6) { background-color: #e0474c; }
.flex-item:nth-of-type(7) { background-color: #7acfd6; }
.flex-item:nth-of-type(8) { background-color: #00c07f; }
.flex-item:nth-of-type(9) { background-color: #cd5554; }