-2
我试图更改列表中项目的背景颜色,而未选择整个列表。我希望第一个列表中的项目背景是绿色的,第二个列表是青色的,但是没有项目符号将自己指向绿色背景?更改HTML5/CSS中特定列表项的颜色
我的代码如下:
<!DOCTYPE html>
<html>
<head>
<title>CSS Exercises 1</title>
<link rel="stylesheet" type="text/css" href="exercise1.css">
</head>
<body>
<ul id="unordered_list">
<li>This is an unordered list.</li>
<li>All items in this list should have a yellow background.</li>
<li>Just the items though - not the whole list!</li>
</ul>
<ol id="ordered_list">
<li>This is an ordered list.</li>
<li>All items in this list should have a teal background.</li>
<li>Just the items thought - not the whole list!</li>
</ol>
</body>
</html>
我的CSS:
#unordered_list {
background-color: yellow;
}
#ordered_list li{
background-color: rgb(2, 132, 130);
}
谢谢!
我不太明白你想要什么...我看到你在那里取得了一些... –
加上'li'以'#unordered_list'像下面的'#ordered_list的一个li' – cocoa
http://jsfiddle.net/h3p7v70j/ – deebs