我有一個問題,我希望我能得到答案。我試圖從頭創建一個網站(不使用Dreamweaver,Expression Web等),我只使用筆記本。我試圖完成的是創建兩個導航鏈接作爲翻轉CSS精靈圖像(使用Pseudo-class元素:懸停)在我想稍後移動頁面的標記中。上週我花了所有的努力試圖解決這個問題,但沒有成功。我去過www.w3schools.com和這個網站以找到一個解決方案,但仍似乎無法讓這個工作正常。我也處於嚴格的環境中,只允許我在Win7操作系統上使用一個瀏覽器(IE8)。請原諒我糟糕的CSS編碼;這是我第一次參加。創建CSS雪碧:懸停滾過圖片鏈接
目前我使用的HTML格式如下兩個鏈接:
<div id="linkbox">
<ul class="GoogleFrame">
<li class="Google"><a href="www.google.com"></a></li>
</ul>
<ul class="BingFrame">
<li class="Bing"><a href="www.bing.com"></a></li>
</ul>
</div>
這裏是我使用上述HTML CSS的:
#linkbox {
width: 312px;
height: 388px;
background: url('images/container.png');
padding: 0px;
margin: 0px;
position: fixed;
left: 0px;
top: 410px;
z-index: 1
}
.GoogleFrame {
position:fixed;
left: 10px;
top: 100px
}
.GoogleFrame li {
list-style:none;
position:absolute;
}
.GoogleFrame li, .GoogleFrame a {
height:54px;
display:block;
}
.Google {
left:0px;
width:260px;
background: url('images/google.png') 0px 0px;
}
.Google a:hover {
background: url('images/google.png') -261px 0px;
}
任何幫助或指導將是不勝感激!
如果您對不同的懸停狀態使用不同的圖像......您並未使用精靈。 –
你的精靈圖像在哪裏? googleh.png或google.png? ** background:url('images/container.png'); **不正確的css指令也是...... –
通常,使用精靈的要點是讓所有的圖像狀態/圖標在同一個圖像文件中。你故意調用兩個不同的圖像文件嗎? – sbeliv01