CSS自动竖向排列的布局方法

来源:互联网 发布:js格式化时间戳format 编辑:程序博客网 时间:2024/06/06 09:04

  • CSS自动竖向排列的布局方法,像电脑桌面的图标一样,自动竖着排,排满一列后重新进行下一列排序。方法有很多,有人用JS,有人用CSS,不管什么样的方法,简单、兼容就是好代码,本代码仅供参考。
http://www.codefans.net/jscss/code/2856.shtml

<!DOCTYPE html>

<html>
<head>
<style>
#mainBox{
border:1px #f00 solid;
width:300px;
height:230px;
writing-mode: tb-lr;
-webkit-column-count:6;
-moz-column-count:6;
-webkit-column-gap:10px;
-moz-column-gap:10px;
}
#mainBox a{
margin:5px;
padding:0px;
display:inline-block;
width:30px;
height:30px;
border:1px #00f solid;
writing-mode: lr-tb;


}
</style>
</head>
<body>


<div id="mainBox">
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#">7</a>
</div>
</body>
</html>
0 0
原创粉丝点击