mmxingye

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

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   独立树  阅读(50)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
点击右上角即可分享
微信分享提示