CSS列表样式(源码示例)

大家好,今天给大家分享一下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>&nbsp;&nbsp;<a href="#">音像</a>&nbsp;&nbsp;<a href="#">数字产品</a></li>
        <li><a href="#">家用电器</a>&nbsp;&nbsp;<a href="#">手机</a>&nbsp;&nbsp;<a href="#">数码</a></li>
        <li> <a href="#">电脑</a>&nbsp;&nbsp;<a href="#">办公</a></li>
        <li><a href="#">家居</a>&nbsp;&nbsp;<a href="#">家装</a>&nbsp;&nbsp;<a href="#">厨具</a></li>
        <li> <a href="#">服饰鞋帽</a>&nbsp;&nbsp;<a href="#">个护化妆</a>
        <li> <a href="#">礼品箱包</a>&nbsp;&nbsp;<a href="#">钟表</a><a href="#">珠宝</a></li>
        <li> <a href="#">食品饮料</a>&nbsp;&nbsp;<a href="#">保健食品</a>
        <li>  <a href="#">彩票</a>&nbsp;&nbsp;<a href="#">旅行</a>&nbsp;&nbsp;<a href="#">充值</a>&nbsp;&nbsp;<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列表样式就到这里了,谢谢大家

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

思诚代码块

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值