通过css切割隐藏外边框,实现十字架或者网格效果

实现代码:

      <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>

实现效果:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_39150852/article/details/82897943
今日推荐