大家好,今天给大家分享一下CSS列表样式
看源码:
写HTML源码;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>列表样式</title>
</head>
<body>
<h2 class="title">全部商品分类</h2>
<ul>
<li><a href="#">图书</a> <a href="#">音像</a> <a href="#">数字产品</a></li>
<li><a href="#">家用电器</a> <a href="#">手机</a> <a href="#">数码</a></li>
<li> <a href="#">电脑</a> <a href="#">办公</a></li>
<li><a href="#">家居</a> <a href="#">家装</a> <a href="#">厨具</a></li>
<li> <a href="#">服饰鞋帽</a> <a href="#">个护化妆</a>
<li> <a href="#">礼品箱包</a> <a href="#">钟表</a><a href="#">珠宝</a></li>
<li> <a href="#">食品饮料</a> <a href="#">保健食品</a>
<li> <a href="#">彩票</a> <a href="#">旅行</a> <a href="#">充值</a> <a href="#">票务</a>
</li>
</ul>
</body>
</html>
显示网页效果:
新建css文件
在HTML文件当中写以下代码
<link rel="stylesheet" href="style.css"/>
在css文件当中写:
.title{
font-size: 18px;
font-weight: bolder;
text-indent: 1em;
line-height: 35px;
}
/*ul li*/
ul li{
height: 30px;
/* 行高*/
}
显示网页结果:
在css文件当中写
list-style: none;
/* 去掉网页当中的点*/
显示网页结果
实例:
.title{
font-size: 18px;
font-weight: bolder;
text-indent: 1em;
line-height: 35px;
background: greenyellow;
}
/*ul{*/
/* color: red;*/
/*}*/
/*ul li*/
ul li {
height: 30px;
/* 行高*/
/* list-style: none;*/
/* 去掉网页当中的点*/
list-style: circle;
text-indent: 1em;
background: yellow;
}
/* 字体间距 */
/* 把它变成空心点 */
/*none 去掉圆点*/
/*circle 空心圆*/
/*decimal 数字*/
/*square 正方形*/
/**!*/
效果:
看源码:
.title{
font-size: 18px;
font-weight: bolder;
text-indent: 1em;
line-height: 35px;
background: greenyellow;
}
/*ul{*/
/* color: red;*/
/*}*/
/*ul li*/
ul li {
height: 30px;
/* 行高*/
/* list-style: none;*/
/* 去掉网页当中的点*/
list-style: circle;
text-indent: 1em;
background: yellow;
}
/* 字体间距 */
/* 把它变成空心点 */
/*none 去掉圆点*/
/*circle 空心圆*/
/*decimal 数字*/
/*square 正方形*/
/**!*/
a{
text-decoration: none;
font-size: 14px;
color: black;
}
a:hover{
color: blueviolet;
/* 鼠标点上去的颜色 */
text-decoration: underline;
/* 加上下划线*/
}
效果:
点上去有下划线的效果
写css代码:
**#nav {
width: 500px;
background:yellow ;
}**
.title{
font-size: 18px;
font-weight: bolder;
text-indent: 1em;
line-height: 35px;
background: greenyellow;
}
/*ul{*/
/* color: red;*/
/*}*/
/*ul li*/
ul li {
height: 30px;
/* 行高*/
/* list-style: none;*/
/* 去掉网页当中的点*/
list-style: circle;
text-indent: 1em;
background: yellow;
}
/* 字体间距 */
/* 把它变成空心点 */
/*none 去掉圆点*/
/*circle 空心圆*/
/*decimal 数字*/
/*square 正方形*/
/**!*/
a{
text-decoration: none;
font-size: 14px;
color: black;
}
a:hover{
color: blueviolet;
/* 鼠标点上去的颜色 */
text-decoration: underline;
/* 加上下划线*/
}
看效果:
就是将它缩小了
好了,关于CSS列表样式就到这里了,谢谢大家