是否可以更改 ul li 元素上每个元素符号图标的颜色(或者甚至只是在每个元素符号上使用不同的图像)?所以 1 是绿色,2 是蓝色,3 是黄色等等。通过 CSS。
现在这是我的小 list ,如果可能的话,我想让元素符号更大。
<nav class="navigation-list">
<ul>
<li><a href="/" class="active">home</a></li>
<li><a href="/About-Us" >about us</a></li>
<li><a href="/Products" >products</a></li>
<li><a href="/Contact-Us" >contact us</a></li>
</ul>
</nav>
CSS
#header .navigation-list {
float: left;
}
#header .navigation-list ul {
margin-top: 38px;
}
#header .navigation-list ul li {
display: inline;
list-style-type: none;
padding: 0 25px;
font-family: newsgoth_btbold;
font-size: 12px;
}
这就是我所追求的:http://tinypic.com/r/11ux6xk/8
最佳答案
ul{
list-style-type: none;
list-style-position: outside;
list-style-image: none;
}
li:before {
content: "• ";
}
.navigation-list ul li:nth-child(1){
color: red; /* or whatever color you prefer */
}
.navigation-list ul li:nth-child(2){
color: blue; /* or whatever color you prefer */
}
您需要为每个更改第 n 个 child +1 的列表项执行此操作
关于html - UL list - 不同颜色的元素符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22196086/