实现代码:
<style type="text/css">
div{
margin: 40px;
width: 320px;
height: 300px;
overflow: hidden;/*超出部分隐藏,切割掉下边框和右边框*/
}
div ul{
/*一个li元素宽度为81px,width大小只要大于(81 x 4)324px,一排就能显示四个li元素*/
width: 325px;
}
div ul li{
/*设置右边框和下边框*/
border-bottom: 1px solid red;
border-right: 1px solid red;
list-style: none;
height: 100px;
width: 80px;
float: left;
}
</style>
实现效果: