您好,登錄后才能下訂單哦!
這篇文章主要介紹“css3怎么實現的多級漸變下拉菜單導航效果代碼”,在日常操作中,相信很多人在css3怎么實現的多級漸變下拉菜單導航效果代碼問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”css3怎么實現的多級漸變下拉菜單導航效果代碼”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
這是一款基于css3實現的下拉菜單導航,是非常漂亮的動畫菜單,而且是多級菜單的形式,測試時發現可支持5級,估計還可以支持更多的子菜單項,只有你想這么增加下去,CSS3實現的效果真的很棒,期待朋友們現在就趕快學習一下CSS3吧,這些Demo肯定會對你幫助很大。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/css3-jb-menu-nav-codes/
具體代碼如下:
代碼如下:
<!DOCTYPE HTML>
<html lang=zh-cn>
<head>
<meta charset=utf-8>
<title>css3下拉菜單導航</title>
<style>
*{margin:0px;padding:0px;}
body{background:#b1b1b1;margin:0px;padding:0px;font-size:14px;color:#000;}
.tips{width:702px;margin:0 auto;line-height:24px;padding-top:10px;}
.bredcolor{color:#fff;}
#menu {width:700px;text-align:center;height:38px;background:#069;margin:50px auto 300px auto;padding:3px 6px;border-radius:6px;box-shadow:0 15px 10px -15px rgba(0,0,0,0.5);}
#menu ul {margin:0;padding:0;list-style:none;white-space:nowrap;text-align:left;background:#069;}
#menu ul {display:inline-block;}
#menu li {margin:0;padding:0;list-style:none;}
#menu li {display:inline-block;display:inline;}
#menu ul ul {position:absolute;left:-9999px;opacity:0;padding:3px 6px;border-radius:6px;box-shadow:0 15px 10px -15px rgba(0,0,0,0.5);
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-ms-transition: opacity 1s;
-o-transition: opacity 1s;
transition: opacity 1s;
}
#menu ul.level1 {margin:0 auto;}
#menu ul.level1 li.level1-li {float:left;display:block;position:relative;}
#menu a {display:block;font:normal 12px tahoma, arial, 宋體b8b\4f53, sans-serif;color:#fff;line-height:30px;text-decoration:none;padding:0 20px 0 10px;margin:3px;background:#069;border:1px solid #09c;border-radius:3px;
background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, rgba(255, 255, 255, 0.7)), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.5, transparent), to(rgba(255, 255, 255, 0.3)));
background-image:-moz-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:-ms-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:-o-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
-webkit-transition: 0.25s;
-moz-transition: 0.25s;
-ms-transition: 0.25s;
-o-transition: 0.25s;
transition: 0.25s;
}
#menu input {display:none;}
#menu label {display:block;font:normal 12px tahoma, arial, 宋體b8b\4f53, sans-serif;color:#fff;line-height:30px;padding:0 20px 0 10px;margin:3px;position:relative;background:#069;border:1px solid #09c;border-radius:3px;
background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, rgba(255, 255, 255, 0.7)), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.5, transparent), to(rgba(255, 255, 255, 0.3)));
background-image:-moz-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:-ms-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:-o-linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
background-image:linear-gradient(top, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0.2) 50%, transparent 50%, rgba(255, 255, 255, 0.3) 100%);
-webkit-transition: 0.25s;
-moz-transition: 0.25s;
-ms-transition: 0.25s;
-o-transition: 0.25s;
transition: 0.25s;
}
#menu label img {position:absolute;left:0;top:0;width:100%;height:100%;}
#menu label b {color:#ff0;}
#menu ul.level1 li.level1-li a.level1-a {float:left;}
#menu input#tab1:checked ~ ul.level1 ul.ul1,
#menu input#tab2:checked ~ ul.level1 ul.ul2,
#menu input#tab3:checked ~ ul.level1 ul.ul3 {opacity:1;left:-6px;top:50px;}
#menu input#tab4:checked ~ ul.level1 ul.ul4 {opacity:1;left:auto;right:0;top:50px;}
#menu input#tab2a:checked ~ ul.level1 ul.ul2,
#menu input#tab2b:checked ~ ul.level1 ul.ul2,
#menu input#tab2c:checked ~ ul.level1 ul.ul2,
#menu input#tab2aa:checked ~ ul.level1 ul.ul2 {opacity:1;left:-6px;top:50px;}
#menu input#tab2a:checked ~ ul.level1 ul.ul2 ul.ul2a,
#menu input#tab2b:checked ~ ul.level1 ul.ul2 ul.ul2b,
#menu input#tab2c:checked ~ ul.level1 ul.ul2 ul.ul2c,
#menu input#tab2aa:checked ~ ul.level1 ul.ul2 ul.ul2a,
#menu input#tab2aa:checked ~ ul.level1 ul.ul2 ul.ul2a ul.ul2aa {opacity:1;left:100%;top:auto;margin-top:-40px;margin-left: 5px;}
#menu input#tab4a:checked ~ ul.level1 ul.ul4,
#menu input#tab4b:checked ~ ul.level1 ul.ul4,
#menu input#tab4aa:checked ~ ul.level1 ul.ul4 {opacity:1;left:auto;right:0;top:50px;}
#menu input#tab4a:checked ~ ul.level1 ul.ul4 ul.ul4a,
#menu input#tab4b:checked ~ ul.level1 ul.ul4 ul.ul4b,
#menu input#tab4aa:checked ~ ul.level1 ul.ul4 ul.ul4a,
#menu input#tab4aa:checked ~ ul.level1 ul.ul4 ul.ul4a ul.ul4aa {opacity:1;left:auto;right:100%;top:auto;margin-top:-40px;margin-right:5px;}
#menu li a:hover {border-color:#fff;}
#menu label.close {position:absolute;width:100%;height:30px;display:none;padding:0;left:0;top:0;border:0;background:transparent;}
#menu input#tab1:checked ~ ul.level1 label.lab1,
#menu input#tab2:checked ~ ul.level1 label.lab2,
#menu input#tab2a:checked ~ ul.level1 label.lab2,
#menu input#tab2b:checked ~ ul.level1 label.lab2,
#menu input#tab2c:checked ~ ul.level1 label.lab2,
#menu input#tab2aa:checked ~ ul.level1 label.lab2,
#menu input#tab3:checked ~ ul.level1 label.lab3,
#menu input#tab4:checked ~ ul.level1 label.lab4,
#menu input#tab4a:checked ~ ul.level1 label.lab4,
#menu input#tab4b:checked ~ ul.level1 label.lab4,
#menu input#tab4aa:checked ~ ul.level1 label.lab4 {display:block;}
</style>
</head>
<body>
<div id="menu">
<input type="radio" name="tab" id="tab1" class="tabs">
<input type="radio" name="tab" id="tab2" class="tabs">
<input type="radio" name="tab" id="tab2a" class="tabs">
<input type="radio" name="tab" id="tab2aa" class="tabs">
<input type="radio" name="tab" id="tab2ab" class="tabs">
<input type="radio" name="tab" id="tab2b" class="tabs">
<input type="radio" name="tab" id="tab2c" class="tabs">
<input type="radio" name="tab" id="tab3" class="tabs">
<input type="radio" name="tab" id="tab4" class="tabs">
<input type="radio" name="tab" id="tab4a" class="tabs">
<input type="radio" name="tab" id="tab4aa" class="tabs">
<input type="radio" name="tab" id="tab4b" class="tabs">
<input type="radio" name="tab" id="tabclose" class="tabs">
<ul class="level1">
<li class="level1-li"><a class="level1-a" href="#">首 頁</a></li>
<li class="level1-li"><label for="tab1" class="open"><img src="images/trans.gif" >關于我 <b>↓</b></label><label for="tabclose" class="close lab1"><img src="images/trans.gif" ></label>
<ul class="ul1">
<li><a href="#">郵 箱</a></li>
<li><a href="#">電 話</a></li>
<li><a href="#">地 址</a></li>
</ul>
</li>
<li class="level1-li"><label for="tab2"><img src="images/trans.gif" >度 假 <b>↓</b></label><label for="tabclose" class="close lab2"><img src="images/trans.gif" ></label>
<ul class="ul2">
<li><a href="#">度假圖片</a></li>
<li><label for="tab2a"><img src="images/trans.gif" >度假商店 <b>→</b></label>
<ul class="ul2a">
<li><a href="#">買東西</a></li>
<li><a href="#">互聯網銷售</a></li>
<li><label for="tab2aa"><img src="images/trans.gif" >買東西圣地 <b>→</b></label>
<ul class="ul2aa">
<li><a href="#">考 驗</a></li>
<li><a href="#">附近的</a></li>
<li><a href="#">指導書</a></li>
<li><a href="#">滑 板</a></li>
</ul>
</li>
<li><a href="#">專家介紹</a></li>
</ul>
</li>
<li><a href="#">有趣生活</a></li>
<li><label for="tab2b"><img src="images/trans.gif" >餐 廳 <b>→</b></label>
<ul class="ul2b">
<li><a href="#">冬季旅館</a></li>
<li><a href="#">夏季旅館</a></li>
<li><a href="#">秋季旅館</a></li>
<li><a href="#">冬季旅館</a></li>
</ul>
</li>
<li><label for="tab2c"><img src="images/trans.gif" >篝火晚會 <b>→</b></label>
<ul class="ul2c">
<li><a href="#">主題晚會</a></li>
<li><a href="#">報導晚會</a></li>
<li><a href="#">野外晚會</a></li>
</ul>
</li>
</ul>
</li>
<li class="level1-li"><label for="tab3"><img src="images/trans.gif" >景區周圍環境 <b>↓</b></label><label for="tabclose" class="close lab3"><img src="images/trans.gif" ></label>
<ul class="ul3">
<li><a href="#">為什么去那</a></li>
<li><a href="#">我們做什么</a></li>
<li><a href="#">風 景</a></li>
<li><a href="#">生活卡品</a></li>
</ul>
</li>
<li class="level1-li"><label for="tab4"><img src="images/trans.gif" >動態信息 <b>↓</b></label><label for="tabclose" class="close lab4"><img src="images/trans.gif" ></label>
<ul class="ul4">
<li><a href="#">支付方法</a></li>
<li><label for="tab4a"><img src="images/trans.gif" ><b>←</b> 了解度假村</label>
<ul class="ul4a">
<li><a href="#">本質生活</a></li>
<li><a href="#">保 險</a></li>
<li><label for="tab4aa"><img src="images/trans.gif" ><b>←</b> 廉價房租</label>
<ul class="ul4aa">
<li><a href="#">客 廳</a></li>
<li><a href="#">臥 室</a></li>
<li><a href="#">陽 臺</a></li>
</ul>
</li><li><a href="#">附近學校</a></li>
<li><a href="#">學世界</a></li>
<li><a href="#">附近學校</a></li>
</ul>
</li>
<li><label for="tab4b"><img src="images/trans.gif" ><b>←</b> 語 言</label>
<ul class="ul4b">
<li><a href="#">英 語</a></li>
<li><a href="#">中 文</a></li>
<li><a href="#">法 語</a></li>
</ul>
</li>
<li><a href="#">厲害啊</a></li>
</ul>
</li>
<li class="level1-li"><a class="level1-a" href="#">世界觀</a></li>
</ul>
</div>
</body>
</html>
到此,關于“css3怎么實現的多級漸變下拉菜單導航效果代碼”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。