我有两个链接,它们是我的导航栏的一部分,有下拉菜单。我想要的是每个下拉菜单的背景图像;仙女的图像,颅骨的不同图像。我想我已经很接近了,但我不确定如何设置它。在阅读了几篇帖子之后,Ryan Rahif 于 5 月 19 日 18:58 发布的帖子非常接近我想要的。我需要创建另一个悬停 div 吗?我需要为每个下拉菜单创建一个悬停吗?
感谢你
<!Doctype HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fairies - Tabbed Dropdown</title>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="nav">
<ul>
<li><a href="#">World of Fairies</a></li>
<li><a href="#">Fairihabitants</a>
<ul>
<li><a href="#">Fairies</a></li>
<li class="cranlink"><a href="#">Craniums</a></li>
</ul>
</li>
<li><a href="#">Fairi-bitats</a>
<ul>
<li><a href="#">Dreams</a></li>
<li><a href="#">Tinkling Bells</a></li>
<li><a href="#">Rain Drops</a></li>
</ul>
</li>
<li><a href="#">Fairy Dust</a></li>
</ul>
</div><!--/#nav-->
</div><!--/#container-->
</body>
</html>
/* CSS Document - Stylesheet.css */
/* BODY AND CONTAINER
-------------------------------------- */
body {
font-size: 76%;
padding: 0px;
margin: 0px;
}
#container {
width: 650px;
padding: 0px;
margin: 0 auto 0 auto;
}
/* MAIN NAVIGATION
-------------------------------------- */
#nav {
float: left;
width: 650px;
height: 50px;
border-bottom: 2px solid #000;
padding: 0px;
margin: 100px 0 0 0;
}
#nav ul {
list-style: none;
padding: 0px;
margin: 0px;
}
#nav ul li {
float: left;
padding: 0px;
margin: 0px;
}
#nav ul li a {
float: left;
width: 150px;
height: 50px;
background-image: url(../images/fairy-gate.jpeg);
background-repeat: repeat-x;
font-family: Arial, Helvetica, sans-serif;
font-size: 1.4em;
line-height: 50px;
color: #fff;
text-decoration: none;
text-align: center;
padding: 0px;
margin: 0 0 0 10px;
}
#nav ul li a:hover {
background-image: url(../images/bg-nav-hover.png);
background-repeat: repeat-x;
}
/* DROPDOWN MENU - MAIN NAVIGATION
-------------------------------------- */
#nav li ul {
display: none;
}
#nav li:hover ul {
width: 150px;
display: block;
visibility: visible;
position: relative;
top: 0px;
clear: both;
z-index: 1;
}
.cranlink {
background-image:url(../images/craniums.jpg);