display:inline-block 来解决盒子高度不一样,造成的盒子浮动

<style>

ul{
width: 320px;
//给父元素添加这两个属性
font-size: 0px;
text-align: center/left;
}
li{
width: 100px;
height: 100px;
margin-right: 10px;
margin-bottom: 10px;

//子元素添加这个属性
display: inline-block;
list-style: none;
background: forestgreen;
}

</style>

posted @ 2018-07-17 23:10  菜鸡~大神  阅读(586)  评论(0编辑  收藏  举报