创建一个html页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>家用电器商品分类</title>
<link rel="stylesheet" href="CSS/Demo4.css" TYPE="text/css">
</head>
<body>
<div class="type">
<div id="title">家用电器</div>
<div class="title2"><a href=" ">大家电</a></div>
<p> <a href=" ">平板点视</a> <a href=" ">洗衣机</a> <a href=" ">冰箱</a><br/>
<a href=" ">空调</a> <a href=" ">烟机/灶具</a> <a href=" ">热水器</a><br/>
<a href=" ">冷柜/酒柜</a> <a href=" ">消毒柜</a> <a href=" ">家庭影院</a>
</p>
<div class="title2"><a href=" ">生活电器</a></div>
<p> <a href=" ">电风扇</a> <a href=" ">净化器</a> <a href=" ">吸尘器</a><br/>
<a href=" ">净水设备</a> <a href=" ">挂烫机</a> <a href=" ">电话机</a>
</p>
<div class="title2"><a href=" ">厨房电器</a></div>
<p> <a href=" ">榨汁机</a> <a href=" ">电压力锅</a> <a href=" ">电饭煲</a><br/>
<a href=" ">豆浆机</a> <a href=" ">微波炉</a> <a href=" ">电磁炉</a>
</p>
<div class="title2"><a href=" ">五金家装</a></div>
<p> <a href=" ">淋浴/水槽</a> <a href=" ">电动工具</a> <a href=" ">手动工具</a><br/>
<a href=" ">仪器仪表</a> <a href=" ">浴霸/排气</a> <a href=" ">灯具</a></p>
</div>
</body>
</html>
创建对应的Demo4.css
@charset "UTF-8";
/*总div的宽度*/
.type{
width:300px;
}
#title{
font-size: 18px;
font-weight: bolder;
line-height: 35px;
background-color: royalblue;
color: white;
}
.title2{
font-size: 14px;
font-weight: bold;
line-height: 30px;
background-color: skyblue;
color: royalblue;
}
/*设置超链接没有下划线*/
a{
text-decoration: none;
}
/*设置超链接鼠标悬浮其上有下划线*/
a:hover{
text-decoration: underline;
}
p{
font-size: 12px;
line-height: 20px;
color: #666666;
text-align: left;
}
/*p标签下面的a标签鼠标悬浮时*/
p a:hover{
color:crimson;
}
效果图