Maison > Article > interface Web > CSS3复习整理(box-sizing,column,flex,inline-box布局)_html/css_WEB-ITnose
nav {display: inline-block;vertical-align: top;width: 25%;border: 1px solid yellowgreen;}.column {display: inline-block;vertical-align: top;width: 74%;border: 1px solid #66BAB7;}更多display
清除浮动
.box { float: left; width: 200px; height: 100px; margin: 1em; border: 1px solid #66BAB7;}.after-box { clear: left;/*left和both都可以*/ border: 1px solid yellowgreen;}
http://zh.learnlayout.com/clearfix.html清除浮动水很深
column多列布局
.three-column{ border: 1px solid #66BAB7; padding: 1em; -webkit-column-count: 3; column-count: 3; -webkit-column-gap: 1em; column-gap: 1em;}
大概这么个效果
box-sizing当你设置一个元素为 box-sizing: border-box 时,此元素的内边距和边框不再会增加它的宽度。
/*此时内边距和边框都不会增加它的宽度*/.simple { width: 500px; margin: 20px auto; border: 1px solid blue; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}.fancy { width: 500px; margin: 20px auto; padding: 50px; border: 10px solid blue; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
flex布局
.container {display: -webkit-flex;display: flex;background: lightblue;}nav {width: 200px;background: #66BAB7;}.flex-column {flex: 1;-webkit-flex: 1;background: yellowgreen;}
.container {display: flex;display: -webkit-flex;}.first {flex: initial;-webkit-flex: initial;width: 200px;min-width: 100px;background: red;}.none {flex: none;-webkit-flex: none;width: 200px;background: yellow;}.flex1 {flex: 1;-webkit-flex: 1;background: yellowgreen;}.flex2 {flex: 2;-webkit-flex: 2;background: #66BAB7;}
.vertical-container {height: 500px;display: -webkit-flex;display: flex;-webkit-align-items: center;align-items: center;-webkit-justify-content: center;justify-content: center;}.div {width: 200px;height: 200px;border: 10px solid #66BAB7;}安利:http://zh.learnlayout.com/toc.html