很漂亮很有個性的CSS水平下拉菜單
來源:易賢網 閱讀:1280 次 日期:2014-08-14 16:50:20
溫馨提示:易賢網小編為您整理了“很漂亮很有個性的CSS水平下拉菜單”,方便廣大網友查閱!

代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://bhx05.cn/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://bhx05.cn/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>CSS Menu - Horizontal</title>

<style type="text/css">

<!--

@import"dhtml-horiz.css";

-->

body {

margin: 0;

padding: 30px;

background: #FFF;

color: #666;

}

h1 {

font: bold 16px Arial, Helvetica, sans-serif;

}

p {

font: 11px Arial, Helvetica, sans-serif;

}

a {

color: #900;

text-decoration: none;

}

a:hover {

background: #900;

color: #FFF;

}

/*CSS Code for Menu Begin:*/

/* Root = Horizontal, Secondary = Vertical */

ul#navmenu {

margin: 0;

border: 0 none;

padding: 0;

width: 500px; /*For KHTML*/

list-style: none;

height: 24px;

}

ul#navmenu li {

margin: 0;

border: 0 none;

padding: 0;

float: left; /*For Gecko*/

display: inline;

list-style: none;

position: relative;

height: 24px;

}

ul#navmenu ul {

margin: 0;

border: 0 none;

padding: 0;

width: 160px;

list-style: none;

display: none;

position: absolute;

top: 24px;

left: 0;

}

ul#navmenu ul li {

float: none; /*For Gecko*/

display: block !important;

display: inline; /*For IE*/

}

/* Root Menu */

ul#navmenu a {

border: 1px solid #FFF;

border-right-color: #CCC;

border-bottom-color: #CCC;

padding: 0 6px;

float: none !important; /*For Opera*/

float: left; /*For IE*/

display: block;

background: #EEE;

color: #666;

font: bold 10px/22px Verdana, Arial, Helvetica, sans-serif;

text-decoration: none;

height: auto !important;

height: 1%; /*For IE*/

}

/* Root Menu Hover Persistence */

ul#navmenu a:hover,

ul#navmenu li:hover a,

ul#navmenu li.iehover a {

background: #CCC;

color: #FFF;

}

/* 2nd Menu */

ul#navmenu li:hover li a,

ul#navmenu li.iehover li a {

float: none;

background: #EEE;

color: #666;

}

/* 2nd Menu Hover Persistence */

ul#navmenu li:hover li a:hover,

ul#navmenu li:hover li:hover a,

ul#navmenu li.iehover li a:hover,

ul#navmenu li.iehover li.iehover a {

background: #CCC;

color: #FFF;

}

/* 3rd Menu */

ul#navmenu li:hover li:hover li a,

ul#navmenu li.iehover li.iehover li a {

background: #EEE;

color: #666;

}

/* 3rd Menu Hover Persistence */

ul#navmenu li:hover li:hover li a:hover,

ul#navmenu li:hover li:hover li:hover a,

ul#navmenu li.iehover li.iehover li a:hover,

ul#navmenu li.iehover li.iehover li.iehover a {

background: #CCC;

color: #FFF;

}

/* 4th Menu */

ul#navmenu li:hover li:hover li:hover li a,

ul#navmenu li.iehover li.iehover li.iehover li a {

background: #EEE;

color: #666;

}

/* 4th Menu Hover */

ul#navmenu li:hover li:hover li:hover li a:hover,

ul#navmenu li.iehover li.iehover li.iehover li a:hover {

background: #CCC;

color: #FFF;

}

ul#navmenu ul ul,

ul#navmenu ul ul ul {

display: none;

position: absolute;

top: 0;

left: 160px;

}

/* Do Not Move - Must Come Before display:block for Gecko */

ul#navmenu li:hover ul ul,

ul#navmenu li:hover ul ul ul,

ul#navmenu li.iehover ul ul,

ul#navmenu li.iehover ul ul ul {

display: none;

}

ul#navmenu li:hover ul,

ul#navmenu ul li:hover ul,

ul#navmenu ul ul li:hover ul,

ul#navmenu li.iehover ul,

ul#navmenu ul li.iehover ul,

ul#navmenu ul ul li.iehover ul {

display: block;

}

</style>

<script type="text/JavaScript">

navHover = function() {

var lis = document.getElementById("navmenu").getElementsByTagName("LI");

for (var i=0; i<lis.length; i++) {

lis[i].onmouseover=function() {

this.className+=" iehover";

}

lis[i].onmouseout=function() {

this.className=this.className.replace(new RegExp(" iehover\\b"), "");

}

}

}

if (window.attachEvent) window.attachEvent("onload", navHover);

</script>

</head>

<body>

<h1>CSS Menu - Horizontal</h1>

<hr />

<ul id="navmenu">

<li><a href="#">Blog</a></li>

<li><a href="#">Work +</a>

<ul>

<li><a href="#">Websites +</a>

<ul>

<li><a href="#">qrayg</a></li>

<li><a href="#">qArcade</a></li>

<li><a href="#">qLoM</a></li>

<li><a href="#">qDT</a></li>

</ul>

</li>

<li><a href="#">Pen and Ink</a></li>

<li><a href="#">Free Interfaces</a></li>

</ul>

</li>

<li><a href="#">Learn +</a>

<ul>

<li><a href="#">Fireworks +</a>

<ul>

<li><a href="#">aquaButton</a></li>

<li><a href="#">aquaButton2</a></li>

<li><a href="#">waterDrop</a></li>

<li><a href="#">lightFX</a></li>

<li><a href="#">lightFX2</a></li>

</ul>

</li>

<li><a href="#">CSS +</a>

<ul>

<li><a href="#">footerStick</a></li>

<li><a href="#">spriteNav</a></li>

<li><a href="#">@import</a></li>

</ul>

</li>

</ul>

</li>

<li><a href="#">Info</a></li>

<li><a href="#">Contact</a></li>

</ul>

</body>

</html>

更多信息請查看IT技術專欄

更多信息請查看網頁制作
易賢網手機網站地址:很漂亮很有個性的CSS水平下拉菜單

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權所有:易賢網