ul li 表示表格
方法一
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
ul {
padding: 0;
margin: 0;
list-style: none;
}
.clearfix::after {
content: '';
display: table;
clear: both;
}
.table {
width: 300px;
}
.table li {
float: left;
width: 101px;
height: 101px;
margin-top: -1px;
margin-left: -1px;
border: 1px solid #000;
box-sizing: border-box;
}
</style>
</head>
<body>
<ul class="table clearfix">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
方法二
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
ul {
padding: 0;
margin: 0;
list-style: none;
}
.clearfix::after {
content: '';
display: table;
clear: both;
}
.table {
width: 300px;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
}
.table li {
float: left;
width: 100px;
height: 100px;
border-top: 1px solid #000;
border-left: 1px solid #000;
box-sizing: border-box;
}
</style>
</head>
<body>
<ul class="table clearfix">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
设置表格左右两侧边框不显示
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
ul {
padding: 0;
margin: 0;
list-style: none;
}
.clearfix::after {
content: '';
display: table;
clear: both;
}
.box {
width: 300px;
overflow: hidden;
}
.table {
width: 302px;
margin-left: -1px;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
}
.table li {
float: left;
width: 33.33%;
height: 100px;
border-top: 1px solid #000;
border-left: 1px solid #000;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="box">
<ul class="table clearfix">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>