css二级下拉水平菜单代码(青灰色下拉菜单)

发布时间:2020-01-05编辑:脚本学堂
分享一个css二级下拉水平菜单的代码,css下拉菜单实例,需要的朋友参考下。

css二级下拉水平菜单,演示效果截图:推荐:css下拉菜单
青灰色二级下拉菜单
 

1,css代码部分
 

复制代码 代码示例:
<style type="text/css">
.menu {font-family: arial, sans-serif;
width:750px; margin:0; margin:50px 0;}
.menu ul {padding:0; margin:0;list-style-type: none;}
.menu ul li {float:left; position:relative;}
.menu ul li a, .menu ul li a:visited {
display:block; text-align:center; text-decoration:none;
width:104px; height:30px; color:#000; border:1px solid #fff;
border-width:1px 1px 0 0;background:#c9c9a7; line-height:30px;
font-size:11px;}
.menu ul li ul {display: none;}
.menu ul li:hover a {color:#fff; background:#b3ab79;}
.menu ul li:hover ul {display:block;
position:absolute; top:31px; left:0; width:105px;}
.menu ul li:hover ul li a {
display:block; background:#faeec7; color:#000;}
.menu ul li:hover ul li a:hover {
background:#dfc184; color:#000;}
</style>
<!--[if lte IE 6]>
<style type="text/css">
table {border-collapse:collapse;margin:0; padding:0;}
.menu ul li a.hide, .menu ul li a:visited.hide {
display:none;}
.menu ul li a:hover {color:#fff; background:#b3ab79;}
.menu ul li a:hover ul {display:block;
position:absolute; top:32px;left:0; width:105px;}
.menu ul li a:hover ul li a {
background:#faeec7; color:#000;}
.menu ul li a:hover ul li a:hover {
background:#dfc184; color:#000;}
</style>
<![endif]-->

2,html部分
 

复制代码 代码示例:
<div class="menu">
<ul>
<li><a class="hide" href="http://www.yuju100.com">DEMOS</a>
<!--[if lte IE 6]>
<a href="../menu/index.html">DEMOS
<table><tr><td>
<![endif]-->
<ul>
<li><a href="http://www.yuju100.com" title="The zero dollar
ads page">zero dollars</a></li>
<li><a href="http://www.yuju100.com" title="Wrapping text around
images">wrapping text</a></li>
<li><a href="http://www.yuju100.com" title="Styling forms">styled
form</a></li>
<li><a href="http://www.yuju100.com" title="Removing active/focus
borders">active focus</a></li>
<li><a href="http://www.yuju100.com" title="Multi-position
drop shadow">shadow boxing</a></li>
<li><a href="http://www.yuju100.com" title="Image Map for
detailed information">image map</a></li>
<li><a href="http://www.yuju100.com" title="fun with background
images">fun backgrounds</a></li>
<li><a href="http://www.yuju100.com" title="fade-out
scrolling">fade scrolling</a></li>
<li><a href="http://www.yuju100.com" title="em size images
compared">em sized images</a></li>
</ul>
<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->
</li>
<li><a class="hide" href="http://www.yuju100.com">MENUS</a>
<!--[if lte IE 6]>
<a href="http://www.yuju100.com">MENUS
<table><tr><td>
<![endif]-->
<ul>
<li><a href="http://www.yuju100.com" title="a coded list of spies">spies
menu</a></li>
<li><a href="http://www.yuju100.com" title="a horizontal vertical
menu">vertical menu</a></li>
<li><a href="http://www.yuju100.com" title="an enlarging unordered
list">enlarging list</a></li>
<li><a href="http://www.yuju100.com" title="an unordered list with link
images">link images</a></li>
<li><a href="http://www.yuju100.com" title="non-rectangular links">non-
rectangular</a></li>
<li><a href="http://www.yuju100.com" title="jigsaw links">jigsaw
links</a></li>
<li><a href="http://www.yuju100.com" title="circular links">circular
links</a></li>
</ul>
<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->
</li>
<li><a class="hide" href="http://www.yuju100.com">LAYOUTS</a>
<!--[if lte IE 6]>
<a href="http://www.yuju100.com">LAYOUTS
<table><tr><td>
<![endif]-->
<ul>
<li><a href="http://www.yuju100.com" title="Cross browser
fixed layout">Fixed 1</a></li>
<li><a href="http://www.yuju100.com" title="Cross browser fixed
layout">Fixed 2</a></li>
<li><a href="http://www.yuju100.com" title="Cross browser fixed
layout">Fixed 3</a></li>
<li><a href="http://www.yuju100.com" title="Cross browser fixed
layout">Fixed 4</a></li>
<li><a href="http://www.yuju100.com" title="A simple minimum
width layout">minimum width</a></li>
</ul>
<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->
</li>
<li><a class="hide" href="http://www.yuju100.com">BOXES</a>
<!--[if lte IE 6]>
<a href="http://www.yuju100.com">BOXES
<table><tr><td>
<![endif]-->
<ul>
<li><a href="http://www.yuju100.com" title="a coded list of spies">spies
menu</a></li>
<li><a href="http://www.yuju100.com" title="a horizontal vertical
menu">vertical menu</a></li>
<li><a href="http://www.yuju100.com" title="an enlarging unordered
list">enlarging list</a></li>
<li><a href="http://www.yuju100.com" title="an unordered list with link
images">link images</a></li>
<li><a href="http://www.yuju100.com" title="non-rectangular links">non-
rectangular</a></li>
<li><a href="http://www.yuju100.com" title="jigsaw links">jigsaw
links</a></li>
<li><a href="http://www.yuju100.com" title="circular links">circular
links</a></li>
</ul>
<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->
</li>
<li><a class="hide" href="http://www.yuju100.com">MOZILLA</a>
<!--[if lte IE 6]>
<a href="http://www.yuju100.com">MOZILLA
<table><tr><td>
<![endif]-->
<ul>
<li><a href="http://www.yuju100.com" title="A drop down
menu">drop down menu</a></li>
<li><a href="http://www.yuju100.com" title="A cascading
menu">cascading menu</a></li>
<li><a href="http://www.yuju100.com" title="Using
content:">content:</a></li>
<li><a href="http://www.yuju100.com" title=":hover applied to a
div">mozzie box</a></li>
<li><a href="http://www.yuju100.com" title="I can build a
rainbow">rainbow box</a></li>
<li><a href="http://www.yuju100.com" title="Snooker
cue">snooker cue</a></li>
<li><a href="http://www.yuju100.com" title="Target
Practise">target practise