您的位置:首页 > Web前端 > CSS

3种盒内元素两端对齐方案

2015-11-17 22:45 519 查看
/*方案1*/
ul {
list-style: none;
padding-left: 0;
width:490px;
overflow:hidden;
background-color: #eee;
}
li {
float:left;
width:100px;
height:50px;
margin-left:30px;
margin-bottom:10px;
background-color: #fff;
}
ul li:nth-child(4n+1) {
margin-left:0;
}

/*方案2*/
ul {
list-style: none;
wi
4000
dth:490px;
-webkit-column-count:4;
-webkit-column-gap:30px;
padding-left:0;
background-color: #eee;
font-size:0;
}
li {
display: inline-block;
width:100px;
height:50px;
margin-bottom: 10px;
background-color: #fff;
}
/*方案3*/
ul {
list-style: none;
width:490px;
font-size: 0;
padding-left: 0;
text-align: justify;
text-justify:distribute-all-lines;  /*兼容IE*/
background-color: #eee;
}
ul:after{
content:" ";
width: 100%;
display: inline-block;
overflow: hidden;
}
li {
display: inline-block;
width: 100px;
height:50px;
margin-top:10px;
background-color: #fff;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css 两端对齐