标题 | css多列布局实现方法大全 |
范文 | 多列布局在网站应用中也是经常见到的,今天就分享4中多列布局。 display:table 代码如下: <style> .table { width: auto; min-width: 1000px; margin: 0 auto; padding: 0; display:table; } .tablerow { display: table-row; } .tablecell { border: 1px solid red; display: table-cell; width: 33%; } </style> <div class=table > <div class=tablerow > <div class=tablecell > one </div> <div class=tablecell > two </div> <div class=tablecell > three </div> </div> </div> float 代码如下: <style> .row { float: left; width: 33%; border: 1px solid red; } </style> <div class=row > one </div> <div class=row > two </div> <div class=row > three </div> display: inline-block 代码如下: <style> .row { display: inline-block; width: 32%; border: 1px solid red; } </style> <div class=row > one </div> <div class=row > two </div> <div class=row > three </div> column-count 代码如下: <style> .column { /* 设置列数 */ -moz-column-count:3; /* firefox */ -webkit-column-count:3; /* safari and chrome */ column-count:3; /* 设置列之间的间距 */ -moz-column-gap:40px; /* firefox */ -webkit-column-gap:40px; /* safari and chrome */ column-gap:40px; /* 设置列之间的规则 */ -moz-column-rule:4px outset #ff0000; /* firefox */ -webkit-column-rule:4px outset #ff0000; /* safari and chrome */ column-rule:4px outset #ff0000; } </style> <div class=column></div> 小结: 以上代码都是在chrome上测试,如果使用请注意兼容性,有任何问题都可以提问 |
随便看 |
|
在线学习网范文大全提供好词好句、学习总结、工作总结、演讲稿等写作素材及范文模板,是学习及工作的有利工具。