行内块元素快速做分页

2022-09-08 16:08:49 浏览数 (1)

通常我们的分页是 ul>li 然后在设置li左浮动间距等,有点麻烦 而如果用行内块元素做就不会遇到上述问题,并且自带间距

代码语言:javascript复制
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
        <style>
            div{
                text-align: center;
            }
            div a{
                display: inline-block;
                width:40px;
                height: 40px;
                background-color: aliceblue;
                color:#333;
                text-align: center;
                line-height: 40px;
                text-decoration: none;

            }
        </style>
    </head>
    <body>
         <div>
            <a href="#">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
         </div>
    </body>
</html>

0 人点赞