问题
当页码到一千多的时候,页码的方框会非常不好看;又不能超出方框
min-width&&padding解决
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
ul {
margin: 0;
display: flex;
justify-content: flex-start;
}
li {
margin-right: 2px;
list-style: none;
padding: 0 3px;
min-width: 24px;
height: 24px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
font-size: 10px;
text-align: center;
line-height: 24px;
}
</style>
</head>
<body>
<div id="main">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>15</li>
<li>15</li>
<li>15</li>
<li>15</li>
<li>152</li>
<li>152</li>
<li>152</li>
<li>152</li>
<li>152</li>
<li>152</li>
<li>1523</li>
<li>1532</li>
<li>1532</li>
<li>1532</li>
<li>1532</li>
</ul>
</div>
</body>
</html>