1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
.flex-demo { display : flex; /*row-reverse column column-reverse*/ flex-direction: row-reverse ; /*flex-end center space-around space-between space-evenly*/ justify-content: space-evenly; /*stretch flex-start flex-end center*/ align-items: stretch; /*combine flex-direction and flex-wrap*/ flex-flow: row wrap ; } .flex-demo div{ /*flex-grow, flex-shrink flex-basic*/ flex:1,1 auto } .grid-demo { display: grid; /*显示定义track*/ grid-template-columns: repeat(3, 1fr); /*隐式定义track*/ grid-auto-rows: 100px; } .grid-demo div:nth-child(1) {grid-column:1/3} .grid-demo div:nth-child(6) {grid-column:1/4} .flex-demo div , .grid-demo div {border:1px solid #ff0000;} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<div class='flex-demo'> <div>div1</div> <div>div2<br/>javacoder.cn</div> <div>div3</div> </div> <div style='height:20px'></div> <div class='grid-demo'> <div>div1</div> <div>div2</div> <div>div3</div> <div>div4</div> <div>div5</div> <div>div6</div> </div> |
Posted in: WEB开发
Comments are closed.