我正在嘗試實踐圖像替換技術,主要用於導航目的。我似乎無法弄清楚爲什麼它不起作用。懸停工作,但默認的菜單項不。我很確定事情寫得正確。爲什麼這個圖像替換技術不起作用?
http://lrroberts0122.github.com/DWS/practical/index.html
這裏的FO導航的HTML:
<ul id="nav">
<li id="process"><a href="index.html" id="active">Our Process</a></li>
<li id="function"><a href="function.html">Bio-Built Function</a></li>
<li id="future"><a href="future.html">The Future</a></li>
<li id="engage"><a href="engage.html">Engage Dio</a></li>
</ul>
這裏是我的導航CSS:
#nav {
list-style: none;
width: 244px;
height: 124px;
overflow: hidden;
}
#nav li {
float: left;
}
#nav li a {
width: 244px;
height: 30px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
display: block;
background: url('../img/bg_nav.png');
}
#process {
background-position: 0 0;
}
#process:hover {
background-position: -244px 0;
}
#function {
background-position: 0 -31px;
}
#function:hover {
background-position: -244px -31px;
}
#future {
background-position: 0 -60px;
}
#future:hover {
background-position: -244px -62px;
}
#engage {
background-position: 0 -90px;
}
#engage:hover {
background-position: -244px -93px;
}
你的問題不是很清楚......如果是用id =「active」,我沒有看到上面的CSS? – robC
如果您查看html文件,所有鏈接都會顯示「我們的流程」。我試圖重新定位背景,但由於某種原因,它不工作,我不知道爲什麼。 – Lindsay