CSS实现的灰色下拉菜单效果代码
网站建设 2023-01-28 21:38www.1681989.com免费网站
本文实例讲述了CSS实现的灰色下拉菜单效果代码。分享给大家供大家参考。具体如下
这是一款基于CSS实现的灰色下拉菜单,支持二级的导航菜单,如果不喜欢灰色的话,颜色你自己调整下,完善后效果是相当不错的。
运行效果截图如下
在线演示地址如下
具体代码如下
复制代码
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://.w3./1999/xhtml" >
<head>
<title>灰色下拉导航菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body { font-family:Arial, Sans-Serif; font-size:13px; marg:0px;
background: transparent url(images/page_bkg.png) repeat scroll center;}
h1 {marg:0px; paddg:20px 0 0 20px;}
p {paddg:20px; color:#dcdcdc;}
p a {color:#9BD800;}
p a:hover {color:#B6FF00;}
#header { height:120px; position:relative;
background: transparent url(images/header_bkg.png) repeat-x scroll center;}
#nav { marg:0px; paddg:0px; position:absolute; : 70px; display:block;}
#nav > li { list-style-type:none; float:left; display:block; marg:0px 10px;
position:relative; paddg:10px; width:100px;}
#nav > li:hover ul { display:block; }
#nav > li:hover { background-color:#808080; -moz-border-radius:10px; -webkit-border-radius:10px; }
#nav li ul { marg:0px; paddg:0px; display:none;}
#nav li ul li { list-style-type:none; marg:10px 0 0 0;}
#nav li ul li a { display:block; paddg:5px 10px; color:#A2E200; text-decoration:none;}
#nav li ul li:hover a { background-color:#606060; -moz-border-radius:5px; -webkit-border-radius:5px;}
#nav li span { cursor:poter; marg:0px 10px; font-weight:bold; }
</style>
</head>
<body>
<div id="header">
<h1>灰色下拉导航菜单</h1>
<ul id="nav">
<li><span>Menu 1</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
<li><span>Menu 2</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
<li><span>Menu 3</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
</ul>
</div>
<p><a href="https://.jb51./jiaoben/list498_1.html">更多漂亮实用的网页菜单</a></p>
</body>
</html>
"http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://.w3./1999/xhtml" >
<head>
<title>灰色下拉导航菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body { font-family:Arial, Sans-Serif; font-size:13px; marg:0px;
background: transparent url(images/page_bkg.png) repeat scroll center;}
h1 {marg:0px; paddg:20px 0 0 20px;}
p {paddg:20px; color:#dcdcdc;}
p a {color:#9BD800;}
p a:hover {color:#B6FF00;}
#header { height:120px; position:relative;
background: transparent url(images/header_bkg.png) repeat-x scroll center;}
#nav { marg:0px; paddg:0px; position:absolute; : 70px; display:block;}
#nav > li { list-style-type:none; float:left; display:block; marg:0px 10px;
position:relative; paddg:10px; width:100px;}
#nav > li:hover ul { display:block; }
#nav > li:hover { background-color:#808080; -moz-border-radius:10px; -webkit-border-radius:10px; }
#nav li ul { marg:0px; paddg:0px; display:none;}
#nav li ul li { list-style-type:none; marg:10px 0 0 0;}
#nav li ul li a { display:block; paddg:5px 10px; color:#A2E200; text-decoration:none;}
#nav li ul li:hover a { background-color:#606060; -moz-border-radius:5px; -webkit-border-radius:5px;}
#nav li span { cursor:poter; marg:0px 10px; font-weight:bold; }
</style>
</head>
<body>
<div id="header">
<h1>灰色下拉导航菜单</h1>
<ul id="nav">
<li><span>Menu 1</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
<li><span>Menu 2</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
<li><span>Menu 3</span>
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
</ul>
</li>
</ul>
</div>
<p><a href="https://.jb51./jiaoben/list498_1.html">更多漂亮实用的网页菜单</a></p>
</body>
</html>
希望本文所述对大家div+css网页设计有所帮助。