我想在悬停时将图像添加到导航列表,但它无法正常工作! 你能看看我这里有什么吗? Example
enter code here
body{background-color:#2D2D2D;}
#nav {
width: 50%;
float: left;
margin: 0 0 3em 0;
padding: 0;
list-style: none;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
}
#nav li {
float: left;
}
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: #069;
border-right: 1px solid #ccc;
}
#nav li :hover{
background: url(http://www.demosphere.com/images/stories/glossy-light-bulb.jpg) no-repeat center top;
opacity:0;
}
感谢您的时间
答案 0 :(得分:0)
因为在这一行 background:url(http://www.demosphere.com/images/stories/glossy-light-bulb.jpg)no-repeat center top;
我认为你使用正确的属性是错误的是使用background-image
background-image:url(http://www.demosphere.com/images/stories/glossy-light-bulb.jpg)no-repeat center top;