我创建了一个 CSS 下拉菜单,可以在这里查看:http: //jsfiddle.net/7ZWnJ/,代码粘贴在下面。
无论如何我可以使下拉部分具有不同的背景颜色(例如:红色),但主标题保持橙色?
非常感谢,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
#brands {
height: 430px;
overflow-y:auto;
overflow-x:hidden;
position: absolute;
width: 460px;
z-index: 123;
}
#menu {
z-index: 999;
}
ul {
font-family: Arial;
font-size: 12px;
margin: 0;
padding: 0;
list-style: none;
font-weight: bold;
}
ul li {
position: relative;
}
li ul {
display: none;
width: 133px;
}
ul li a {
display: block;
text-decoration: none;
color: #ffffff;
padding: 3px 15px 3px 15px;
margin: 0;
border-top: #f79448 1px solid;
border-bottom: #f79448 1px solid;
}
ul li a:hover {
z-index: 1000;
background-color: #F79448;
}
li:hover ul {
display: block;
position: absolute;
z-index: 1000;
width: 134px;
margin-left: -3px;
}
li:hover li {
font-size: 12px;
}
li:hover a {
background-color: #F79448;
}
li:hover li a:hover {
}
</style>
</head>
<body>
<table border="0" cellpadding="3" cellspacing="0">
<tr class="nav-links">
<td width="128" height="18" align="center" bgcolor="#f79448">
<ul id="menu2">
<li class="2"><a href="#">OPTION 1</a>
<ul>
<li><a href="#">OPTION 2</a>
</li>
<li><a href="#">OPTION 3</a>
</li>
<li><a href="#">OPTION 4</a>
</li>
</ul>
</li>
</ul>
</td>
</tr>
</table>
</body>
</html>