<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>实现table形式的网格</title>
<style>
ul,li {
list-style: none;
margin: 0;
padding: 0
}
.clearfix::after {
content: '';
display: block;
clear: both;
}
/*
//一种形式
.table {
width: 300px;
!*overflow: hidden;!* BFC Block format content*!*!
}
.table li {
width: 101px;
height: 101px;
border: 1px solid black;
float: left;
box-sizing: border-box;
margin-left: -1px;
margin-top: -1px;
}*/
/*另一种形式*/
.table {
width: 300px;
border-right: 1px solid black;
border-bottom: 1px solid black;
}
.table li {
width: 100px;
height: 100px;
float: left;
box-sizing: border-box;
border-top: 1px solid black;
border-left: 1px solid black;
}
</style>
</head>
<body>
<div class="table">
<ul class="clearfix">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
css 实现table形式的网格
最新推荐文章于 2025-04-08 16:27:07 发布