<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
list-style: none;
}
ul {
width: 300px;
display: table;
}
ul li {
display: table-cell;
background: red;
height: 60px;
}
ul li:nth-child(2) {
background: yellow;
}
ul li:nth-child(4) {
background: yellow;
}
</style>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</body>
</html>
display:table,布局自动分宽度
最新推荐文章于 2024-01-24 12:19:34 发布