11 | HTML ul 的一个小例子

<!DOCTYPE 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-type: none;
        }
        ul>li{
            border-bottom: 1px solid #ccc;
            padding: 10px;
        }
        /* 特别关注最后一个,因为它的边框会和div的边框重叠造成加粗 */
        .last{
            border: none;
        }
        /* <!--转成内联性质的块元素来决定它的宽高--> */
        span{
            display: inline-block;
            width: 30px;
            text-align: center;
            font-size: 25px;
            font-weight: bold;
        }
        #news{
            width:  834px;
            border-top: 4px solid #ccc;
            border-left: 1px solid #ccc;
            border-right: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            padding: 0px 15px;
        }
    </style>
</head>
<body>
    <div id="news">
        <ul>
            <li><span>1</span>媒体:</li>
            <li><span>2</span>媒体:</li>
            <li><span>3</span>媒体:</li>
            <li class="last"><span>4</span>媒体:</li>
        </ul>
    </div>
</body>
</html>
posted on 2022-06-15 21:31  独立树  阅读(66)  评论(0)    收藏  举报