61,112
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
ul,li{padding: 0;margin: 0;}
li{list-style: none;
width: 150px;height: 50px;
background:#613E72 url(icon.png)
no-repeat 5px center;margin:10px 30px;
padding-left:35px;
color:white;line-height:50px;font-weight:}
.one{background-color: white;
color:#613E72 url(clock.png)
no-repeat 5px center;margin:10px 30px;}
.six{background-color: white;
color: #613E72 url(back.png)
no-repeat 5px center;margin:10px 30px;}
li:hover{background-color: yellow;}
ul{width: 250px;border: solid 5px #613E72;}
a:link,a:visited{color: black;text-decoration: none;}
a:hover{background-color: yellow;text-decoration-skip: underline;}
</style>
</head>
<body>
<ul>
<li class="one">7月30日0:00开团</li>
<li>新品团</li>
<li>尝鲜团</li>
<li>秒杀团</li>
<li>清仓团</li>
<a href="01"><li class="six">返回顶部</li></a>
</ul>
<hr/>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
li,ul{margin:0;padding:0;}
li{margin:10px 30px;padding-left:35px;width:150px;height:50px;background:#613e72 url(icon.png) no-repeat 5px center;color:#fff;list-style:none;line-height:50px;}
body .one{margin:10px 30px;background:#613e72 url(clock.png) no-repeat 5px center;}
body .six{margin:10px 30px;background:#613e72 url(back.png) no-repeat 5px center;}
li:hover{background-color:#ff0;}
ul{width:250px;border:solid 5px #613e72;}
a:link,a:visited{color:#000;text-decoration:none;}
a:hover{background-color:#ff0;text-decoration-skip:underline;}
</style>
</head>
<body>
<ul>
<li class="one">7月30日0:00开团</li>
<li>新品团</li>
<li>尝鲜团</li>
<li>秒杀团</li>
<li>清仓团</li>
<a href="01"><li class="six">返回顶部</li></a>
</ul>
<hr/>
</body>
</html>
你样式写错了。
color:#613e72 url(clock.png) no-repeat 5px center;
修改为
background:#613e72 url(clock.png) no-repeat 5px center;
设置一个li公用的class,该class里包含除background-image以外的所有样式,让所有li元素包含该样式,然后可以通过class:nth-child(0),class:nth-child(1)...单独设置background-image
请问怎么弄的,一个li单独弄一个太麻烦了,只需要改两个,有什么好的办法吗?