純html5+css3下拉導(dǎo)航菜單實(shí)現(xiàn)代碼
來(lái)源:易賢網(wǎng) 閱讀:1677 次 日期:2016-07-13 16:14:09
溫馨提示:易賢網(wǎng)小編為您整理了“純html5+css3下拉導(dǎo)航菜單實(shí)現(xiàn)代碼”,方便廣大網(wǎng)友查閱!

下拉導(dǎo)航在瀏覽網(wǎng)頁(yè)時(shí)經(jīng)常會(huì)遇見(jiàn)到,記得以前都是使用js實(shí)現(xiàn)的吧,不過(guò)本文接下來(lái)要介紹的是采用css3+html5實(shí)現(xiàn),感興趣的你可不要錯(cuò)過(guò)了哈,希望看完對(duì)你學(xué)習(xí)css3有所幫助

代碼如下:

<!DOCTYPE HTML>

<html>

<head>

<meta charset="UTF-8" />

<title>純html+css導(dǎo)航</title>

<!-- mulder -->

<!-- qq:10221408 -->

<!-- 只支持 chrome firefox -->

<style>

*{

margin:0;

padding:0;

}

.clear:after {

clear: both;

content: ".";

display: block;

height: 0;

visibility: hidden;

}

nav{

display:inline-block;

border:1px solid #505255;

border-bottom: 1px solid #282C2F;

-moz-border-radius: 5px;

-webkit-border-radius: 5px;

margin:50px;

-webkit-box-shadow:1px 1px 3px #292929;

-moz-box-shadow:1px 1px 3px #292929;

}

li{

list-style:none;

float:left;

border-right: 1px solid #2E3235;

position: relative;

/*background: -moz-linear-gradient(top, #fff, #555D5F 2% ,#555D5F 50%,#3E4245 100%);

background: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), color-stop(2%, #555D5F), color-stop(50%, #555D5F),to(#3E4245));*/

background:#555D5F;

}

li:hover{

/*background: -moz-linear-gradient(top, #fff, #3E4245 2% ,#555D5F 80%,#555D5F 100%);

background: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), color-stop(2%, #3E4245), color-stop(80%, #3E4245),to(#555D5F));*/

background:#3E4245;

-moz-transition: background 1s ease-out;

-webkit-transition: background 1s ease-out;

}

li a{

display:block;

height:40px;

line-height:40px;

padding:0 30px;

font-size:12px;

color:#fff;

text-shadow: 0px -1px 0px #000;

text-decoration:none;

white-space:nowrap;

border-left: 1px solid #999E9F;

border-top: 1px solid #999E9F;

-moz-border-top-left-radius: 2px;

-webkit-border-top-left-radius: 2px;

z-index:100;

}

li > a{

position:relative;

}

li.first a{

-moz-border-radius-topleft: 4px;

-moz-border-radius-bottomleft: 4px;

-webkit-border-top-left-radius: 4px;

-webkit-border-bottom-left-radius: 4px;

}

li.last{

border-right: 0 none;

}

dl{

position:absolute;

display:block;

top:40px;

left: -25px;

width:165px;

background:#222222;

-moz-border-radius: 5px;

-webkit-border-radius: 5px;

-webkit-box-shadow:1px 1px 3px #292929;

-moz-box-shadow:1px 1px 3px #292929;

z-index:10;

}

li:hover dl{

top:50px;

display:block;

width:145px;

padding:10px;

}

dl a{

background:transparent;

border:0 none;

-moz-border-radius: 5px;

-webkit-border-radius: 5px;

-moz-transition: background 0.5s ease-out;

-webkit-transition: background 0.5s ease-out;

z-index:50;

}

dl a:hover{

color:#FFF;

background:#999E9F;

-moz-transition: background 0.3s ease-in-out, color 0.3s ease-in-out;

-webkit-transition: background 0.3s ease-in-out, color 0.3s ease-in-out;

}

dd{

margin-top:-40px;

opacity:0;

width:145px;

-webkit-transition-property:all;

/*-webkit-transition-timing-function: cubic-bezier(5,0,5,0);*/

-moz-transition-property: all;

/*-moz-transition-timing-function: cubic-bezier(5,0,5,0);*/

/*-webkit-transition-delay:5s;

-moz-transition-delay:5s;*/

}

li:hover dd{

margin-top:0;

opacity:1;

}

li dd:nth-child(1){

-webkit-transition-duration: 0.1s;

-moz-transition-duration: 0.1s;

}

li dd:nth-child(2){

-webkit-transition-duration: 0.2s;

-moz-transition-duration: 0.2s;

}

li dd:nth-child(3){

-webkit-transition-duration: 0.3s;

-moz-transition-duration: 0.3s;

}

li dd:nth-child(4){

-webkit-transition-duration: 0.4s;

-moz-transition-duration: 0.4s;

}

dt{

display:none;

margin-top:-25px;

padding-top:15px;

height:10px;

}

li:hover dt{

display:block;

}

.Darrow{

float:right;

margin:18px 10px 0 0;

border-width:5px;

border-color:#FFF transparent transparent transparent;

border-style:solid;

width:0;

height:0;

line-height:0;

overflow:hidden;

cursor:pointer;

text-shadow: 0px -1px 0px #000;

-webkit-box-shadow:0px -1px 0px #000;

-moz-box-shadow:0px -1px 0px #000;

}

.arrow{

margin:0 auto;

margin-top:-5px;

display:block;

width:10px;

height:10px;

background:#222222;

-webkit-transform: rotate(45deg);

-moz-transform: rotate(45deg);

}

</style>

</head>

<body>

<nav>

<ul class="clear">

<li class="first"><a href="#">菜單一</a></li>

<li>

<span class="Darrow"></span>

<a href="#">菜單二</a>

<dl>

<dt><span class="arrow"></span></dt>

<dd><a href="#">子菜單一</a></dd>

<dd><a href="#">子菜單二</a></dd>

<dd><a href="#">子菜單三子菜單三</a></dd>

</dl>

</li>

<li>

<span class="Darrow"></span>

<a href="#">菜單三</a>

<dl>

<dt><span class="arrow"></span></dt>

<dd><a href="#">子菜單一</a></dd>

<dd><a href="#">子菜單二</a></dd>

<dd><a href="#">子菜單三子菜單三</a></dd>

</dl>

</li>

<li>

<span class="Darrow"></span>

<a href="#">菜單四</a>

<dl>

<dt><span class="arrow"></span></dt>

<dd><a href="#">子菜單一</a></dd>

<dd><a href="#">子菜單二</a></dd>

<dd><a href="#">子菜單三</a></dd>

<dd><a href="#">子菜單四</a></dd>

</dl>

</li>

<li><a href="#">菜單五</a></li>

<li><a href="#">菜單六</a></li>

<li><a href="#">菜單七</a></li>

<li class="last"><a href="#">菜單八</a></li>

</ul>

</nav>

</body>

</html>

更多信息請(qǐng)查看網(wǎng)頁(yè)制作
易賢網(wǎng)手機(jī)網(wǎng)站地址:純html5+css3下拉導(dǎo)航菜單實(shí)現(xiàn)代碼
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!
相關(guān)閱讀網(wǎng)頁(yè)制作

2025國(guó)考·省考課程試聽(tīng)報(bào)名

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