本文實例講述了純CSS實現漂亮的下拉導航效果代碼。分享給大家供大家參考。具體如下:
這是一款純CSS完成的下拉導航代碼,藍色經典色調,非常大氣,適合政府和企業類網站作為頂部的導航菜單,浏覽器兼容性完成OK,有需要的朋友可以拿去。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.Net/JS/2015/CSS-xlcd-nav-menu-codes/
具體代碼如下:
復制代碼代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD Html 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-Html401-19991224/loose.dtd">
<HTML XMLns="http://www.w3.org/1999/xHtml">
<HEAD id=Head1>
<TITLE>純CSS下拉菜單</TITLE>
<META http-equiv=Content-Type content="text/Html; charset=utf-8">
<style>
* {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
UL {
LIST-STYLE-TYPE: none
}
LI {
LIST-STYLE-TYPE: none
}
DL {
LIST-STYLE-TYPE: none
}
DD {
LIST-STYLE-TYPE: none
}
DT {
LIST-STYLE-TYPE: none
}
A {
COLOR: #414141; TEXT-DECORATION: none
}
IMG {
DISPLAY: inline-block; FONT-SIZE: 12px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none
}
A:hover {
COLOR: #c51007
}
#dangqian A {
COLOR: #c51007
}
.clear {
CLEAR: both
}
.warper {
MARGIN: 0px auto; WIDTH: 1000px
}
.menu {
MARGIN-TOP: 3px; FONT-SIZE: 12px; BACKGROUND: url(images/menu_02.gif) repeat-x; LINE-HEIGHT: 28px; HEIGHT: 28px
}
.menu_01 {
FLOAT: left
}
.menu_02 {
FLOAT: right
}
.menu A {
FONT-WEIGHT: bold; COLOR: #fff
}
.menu A:hover {
COLOR: #b8def6
}
.menu DL {
FLOAT: left
}
.menu DD {
FLOAT: left; WIDTH: 132px; TEXT-ALIGN: center
}
.menu DT {
PADDING-LEFT: 1px; BACKGROUND: url(images/menu_04.gif) no-repeat left top; FLOAT: left; WIDTH: 122px; POSITION: relative; HEIGHT: 28px; TEXT-ALIGN: center
}
.menuli_div {
BACKGROUND: #0068aa; LEFT: 1px; PADDING-BOTTOM: 8px; WIDTH: 122px; POSITION: absolute; TOP: 28px
}
.menuli_div LI {
BACKGROUND: url(images/menu_05.gif) no-repeat center bottom; PADDING-BOTTOM: 1px; LINE-HEIGHT: 24px; HEIGHT: 24px
}
.menu DT UL LI A {
FONT-WEIGHT: normal
}
.menuli .menuli_div {
DISPLAY: none
}
.menuli_hover .menuli_div {
DISPLAY: block
}
</style>
<BODY onselectstart="return false">
<DIV class=warper>
<DIV class=menu><DL>
<DD><A href="#" target=_self>首頁</A></DD>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A href="#"
target=_self>關於家鄉網</A>
<UL class=menuli_div>
<LI><A href="#">About</A></LI>
<LI><A href="#">家鄉網</A></LI>
<LI><A href="#">中國網</A></LI>
<LI><A href="#">大武漢</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A href="#"
target=_self>資訊動態</A>
<UL class=menuli_div>
<LI><A href="#">省內</A></LI>
<LI><A href="#">省外</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A
href="#" target=_self>組織機構</A>
<UL class=menuli_div>
<LI><A href="#">省委</A></LI>
<LI><A href="#">政府</A></LI>
<LI><A href="#">政協</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A
href="#" target=_self>主營業務</A>
<UL class=menuli_div>
<LI><A href="#">淘寶</A></LI>
<LI><A href="#">手機</A></LI>
<LI><A href="#">相機</A></LI>
<LI><A href="#">電腦</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A href="#"
target=_self>品牌戰略</A>
<UL class=menuli_div>
<LI><A href="#">一杯水</A></LI>
<LI><A href="#">城市生活</A></LI>
<LI><A href="#">家鄉網</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A href="#"
target=_self>人才招聘</A>
<UL class=menuli_div>
<LI><A href="#">我的家</A></LI>
<LI><A href="#">家鄉網</A></LI>
</UL></DT>
<DT class=menuli onMouSEOver="this.className='menuli_hover'"
onmouSEOut="this.className='menuli'"><A
href="#" target=_self>聯系我們</A>
<UL class=menuli_div>
<LI><A href="#">聯系我</A></LI>
<LI><A href="#">聯系她</A></LI>
<LI><A href="#">我的家</A></LI>
</UL></DT></DL></DIV>
</BODY>
</Html>
希望本文所述對大家的div+CSS網頁設計有所幫助。