1.清除li小圆点以及默认空白
2.内外边距加li→每个li都有
内外边距加ul→所有li最外一圈才有
<!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>14-快报模块布局分析-综合案例</title>
<!-- 案例核心
1.避开边框,测盒子大小
2.去掉li前面小圆点及默认空白:list-style:none; 和内外边距清零做成。
3.ul是块级元素,不需要再装div了
4.给li内外边距-→导致每个li都有内外边距(只给li周围值时,加在ul身上)
5.注意用复合写法,不要频繁用类名
-->
<style>
* {
padding: 0;
margin: 0;
}
li {
list-style: none;
}
.box {
background-color: #fdfffc;
width: 248px;
height: 163px;
border: 1px solid #ccc;
margin: 100px auto;
box-shadow: 0 15px 30px rgb(0 0 0 / 10%);
}
.box h4 {
height: 32px;
line-height: 32px;
/* 垂直居中 */
border-bottom: 1px dotted #ccc;
font-size: 14px;
padding: 0 15px;
font-weight: normal;
}
.box ul li a {
color: #666;
font-size: 12px;
text-decoration: none;
}
.box ul li a:hover {
text-decoration: underline;
}
.box ul li {
height: 23px;
line-height: 23px;
padding-left: 20px;
}
.box ul {
margin-top: 7px;
}
</style>
</head>
<body>
<div class="box">
<h4>品优购快报</h4>
<ul>
<li> <a href="#">【特惠】爆款耳机5折秒!</a> </li>
<li> <a href="#">【特惠】母亲节,健康好礼低至5折!</a> </li>
<li> <a href="#">【特惠】爆款耳机5折秒!</a> </li>
<li> <a href="#">【特惠】9.9元洗照片100张!</a> </li>
<li> <a href="#">【特惠】长虹智能空调立省1000元!</a> </li>
</ul>
</div>
</body>
</html>