http://kilgourschameleons.com/new/test/index.asp
我使用css和sprites遇到了一个非常奇怪的问题。如果您转到上面的链接,您会看到所有导航翻转工作但“home”。我已经对所有按钮使用了相同的代码,并尝试复制那些有效的代码,只是替换翻转的名称,使用像“asdf”这样的名称作为名称,以防“home”被保留,等等。这使得NO SENSE。
<div>
<img src="images/spacer.gif" width=960 height=104 border=0>
</div>
<center>
<ul id="navigation">
<li><a href="index.asp" class="home active"></a></li>
<li><a href="gallery.asp" class="gallery"></a></li>
<li><a href="care.asp" class="care"></a></li>
<li><a href="products.asp" class="products"></a></li>
<li><a href="sires.asp" class="sires"></a></li>
<li><a href="faq.asp" class="faq"></a></li>
<li><a href="about.asp" class="about"></a></li>
</ul>
</center>
<div>
<img src="images/spacer.gif" width=960 height=37 border=0>
</div>
这是css ......
#navigation {
position:relative;
top:0px;
width:960px;
height=55px;
text-align:center;
margin-left: 0 auto;
margin-right: 0 auto;
margin:0;
z-index:1000;
}
#navigation li {
float: left;
}
#navigation li a {
background: url("../images/navigation_bg.png") no-repeat scroll left top transparent;
display: block;
height: 55px;
}
#navigation li a.home {
background-position: 0px 0px;
width: 148px;
}
#navigation li a.gallery {
background-position: -148px 0px;
width: 109px;
}
#navigation li a.care {
background-position: -257px 0px;
width: 84px;
}
#navigation li a.products {
background-position: -341px 0px;
width: 115px;
}
#navigation li a.sires {
background-position: -456px 0px;
width: 79px;
}
#navigation li a.faq {
background-position: -535px 0px;
width: 80px;
}
#navigation li a.about {
background-position: -615px 0px;
width: 120px;
}
}
#navigation li a.home:hover, #navigation li a.home.active {
background-position: 0px -55px;
}
#navigation li a.gallery:hover, #navigation li a.gallery.active {
background-position: -148px -55px;
}
#navigation li a.care:hover, #navigation li a.care.active {
background-position: -257px -55px;
}
#navigation li a.products:hover, #navigation li a.products.active {
background-position: -341px -55px;
}
#navigation li a.sires:hover, #navigation li a.sires.active {
background-position: -456px -55px;
}
#navigation li a.faq:hover, #navigation li a.faq.active {
background-position: -535px -55px;
}
#navigation li a.about:hover, #navigation li a.about.active {
background-position: -615px -55px;
}
答案 0 :(得分:3)
如果你摆脱了css文件中的额外}
会怎样?看起来它会起作用。