用css網站布局之十步實錄!(十)_DIV+CSS實例
教程Tag:暫無Tag,歡迎添加,賺取U幣!
第十步:解決IE瀏覽器的顯示BUG
要繼續此教程需要IE的以前的版本進行測試,絕大部分用戶使用的是IE6.0,因此您幾乎不需要看下去了。IE中主要出問題的是IE5和IE5.5,如其不能識別css中margin值為auto,要實現層的中間對齊,需加入:
但是這樣設置之后,網站的content層的文本也變成中間對齊了,我們需要讓其向左對齊,加入:
關于頁腳的BUG,將版權內容加入新的#copyright層中,在html中加入:
在css文件中加入,并將#footer的padding-top: 13px;移除:
最后要解決的BUG是當光標在導航條的被選列表項目鏈接上懸停時(如在about的網頁,body的類為about,但我們將光標移到導航條的about圖片上時),背景圖片消失了,這就需要加入:
本教程到此結束。感謝原作者Steve Dennis,感謝Jorux的精心翻譯!
要繼續此教程需要IE的以前的版本進行測試,絕大部分用戶使用的是IE6.0,因此您幾乎不需要看下去了。IE中主要出問題的是IE5和IE5.5,如其不能識別css中margin值為auto,要實現層的中間對齊,需加入:
示例代碼 [www.wf0088.com]
body {
font-family: Arial, Helvetica, Verdana, Sans-serif;
font-size: 12px;
color: #666666;
text-align: center;
}
font-family: Arial, Helvetica, Verdana, Sans-serif;
font-size: 12px;
color: #666666;
text-align: center;
}
但是這樣設置之后,網站的content層的文本也變成中間對齊了,我們需要讓其向左對齊,加入:
示例代碼 [www.wf0088.com]
#page-container {
width: 760px;
margin: auto;
text-align: left;}
width: 760px;
margin: auto;
text-align: left;}
關于頁腳的BUG,將版權內容加入新的#copyright層中,在html中加入:
示例代碼 [www.wf0088.com]
<div id="copyright">
Copyright ? Enlighten Designs<br />
Powered by <a xhref="#"">Enlighten Hosting</a> and
<a xhref="#">Vadmin 3.0</a>
</div>
Copyright ? Enlighten Designs<br />
Powered by <a xhref="#"">Enlighten Hosting</a> and
<a xhref="#">Vadmin 3.0</a>
</div>
在css文件中加入,并將#footer的padding-top: 13px;移除:
示例代碼 [www.wf0088.com]
#footer #altnav {
clear: both;
width: 350px;
float: right;
text-align: right;
padding-top: 13px;
}
#footer #copyright {
padding-top: 13px;
}
clear: both;
width: 350px;
float: right;
text-align: right;
padding-top: 13px;
}
#footer #copyright {
padding-top: 13px;
}
最后要解決的BUG是當光標在導航條的被選列表項目鏈接上懸停時(如在about的網頁,body的類為about,但我們將光標移到導航條的about圖片上時),背景圖片消失了,這就需要加入:
示例代碼 [www.wf0088.com]
body.about li#about,
body.about li#about a,
body.about li#about a:hover,
body.services li#services,
body.services li#services a,
body.services li#services a:hover,
body.portfolio li#portfolio,
body.portfolio li#portfolio a,
body.portfolio li#portfolio a:hover,
body.contact li#contact,
body.contact li#contact a,
body.contact li#contact a:hover {
background-position: 0 -100px;
}
body.about li#about a,
body.about li#about a:hover,
body.services li#services,
body.services li#services a,
body.services li#services a:hover,
body.portfolio li#portfolio,
body.portfolio li#portfolio a,
body.portfolio li#portfolio a:hover,
body.contact li#contact,
body.contact li#contact a,
body.contact li#contact a:hover {
background-position: 0 -100px;
}
本教程到此結束。感謝原作者Steve Dennis,感謝Jorux的精心翻譯!
相關DIV+CSS實例:
- 相關鏈接:
- 教程說明:
DIV+CSS實例-用css網站布局之十步實錄!(十)。