CSS实现带阴影效果的黑色导航菜单效果
网站建设 2023-01-28 21:38www.1681989.com免费网站
本文实例讲述了CSS实现带阴影效果的黑色导航菜单效果。分享给大家供大家参考。具体如下
这是一款CSS实现带阴影效果黑色导航菜单,有立体感,鼠标放到菜单上会看到菜单的背景在变化,纯CSS的代码应用,没有使用任何的JavaScript代码。如果你觉得菜单的背景颜色和文字颜色不是您想要的,你还可以自己修改CSS文件,只要你有创意,一个漂亮菜单就会诞生。
运行效果截图如下
在线演示地址如下
具体代码如下
复制代码
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://.w3./TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://.w3./1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>黑色炫酷个人网站导航菜单</title>
<style>
.bg {background: url(images/button4.gif);}
.menu {paddg:0 0 0 32px; marg:0; list-style:none; height:40px; background:#fff url(images/button1a.gif) repeat-x; position:relative; font-family:arial, verdana, sans-serif; marg-:100px;}
.menu li. {display:block; float:left; position:relative;}
.menu li a._lk {display:block; float:left; height:40px; le-height:33px; color:#bbb; text-decoration:none; font-size:11px; font-weight:bold; paddg:0 0 0 12px; cursor:poter;}
.menu li a._lk span {float:left; font-weight:bold; display:block; paddg:0 24px 0 12px; height:40px;}
.menu li a._lk span.down {float:left; display:block; paddg:0 24px 0 12px; height:40px; background:url(images/down.gif) no-repeat right ;}
.menu li a._lk:hover {color:#000; background: url(images/button4.gif) no-repeat;}
.menu li a._lk:hover span {background:url(images/button4.gif) no-repeat right ;}
.menu li a._lk:hover span.down {background:url(images/button4a.gif) no-repeat right ;}
.menu li:hover > a._lk {color:#000; background: url(images/button4.gif) no-repeat;}
.menu li:hover > a._lk span {background:url(images/button4.gif) no-repeat right ;}
.menu li:hover > a._lk span.down {background:url(images/button4a.gif) no-repeat right ;}
.menu table {border-collapse:collapse; width:0; height:0; position:absolute; :0; left:0;}
.menu a:hover {visibility:visible;}
.menu li:hover {position:relative; z-dex:200;}
.menu ul,
.menu :hover ul ul,
.menu :hover ul :hover ul ul,
.menu :hover ul :hover ul :hover ul ul,
.menu :hover ul :hover ul :hover ul :hover ul ul {position:absolute; left:-9999px; :-9999px; width:0; height:0; marg:0; paddg:0; list-style:none;}
.menu :hover ul.sub {left:2px; :40px; right:2px; background: #fff; paddg:3px 0; border:1px solid #999999; white-space:nowrap; width:200px; height:auto;}
.menu :hover ul.sub li {display:block; height:20px; position:relative; float:left; width:250px;}
.menu :hover ul.sub li a {font-weight:normal;display:block; font-size:11px; height:20px; width:192px; le-height:20px; text-dent:5px; color:#000; text-decoration:none; border:3px solid #fff; border-width:0 0 0 3px;}
.menu :hover ul.sub li a.fly {background:#fff url(images/arrow.gif) 80px 7px no-repeat;}
.menu :hover ul.sub li a:hover {background:#999999; color:#fff;}
.menu :hover ul.sub li a.fly:hover {background:#999999 url(images/arrow_over.gif) 80px 7px no-repeat; color:#fff;}
.menu :hover ul li:hover > a.fly {background:#999999 url(images/arrow_over.gif) 80px 7px no-repeat; color:#fff;}
.menu :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul :hover ul :hover ul
{left:90px; :-4px; background: #fff; paddg:3px 0; border:1px solid 999999; white-space:nowrap; width:93px; z-dex:200; height:auto;}
</style>
</head>
<body>
<div>
<ul class="menu">
<li class=""><a href="#" class="_lk"><span>首页</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的相册</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的日志</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的音乐盒</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的介绍</span></a></li>
<li class=""><a href="#" class="_lk"><span>留言本</span></a></li>
</ul>
</div>
</body>
</html>
"http://.w3./TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://.w3./1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>黑色炫酷个人网站导航菜单</title>
<style>
.bg {background: url(images/button4.gif);}
.menu {paddg:0 0 0 32px; marg:0; list-style:none; height:40px; background:#fff url(images/button1a.gif) repeat-x; position:relative; font-family:arial, verdana, sans-serif; marg-:100px;}
.menu li. {display:block; float:left; position:relative;}
.menu li a._lk {display:block; float:left; height:40px; le-height:33px; color:#bbb; text-decoration:none; font-size:11px; font-weight:bold; paddg:0 0 0 12px; cursor:poter;}
.menu li a._lk span {float:left; font-weight:bold; display:block; paddg:0 24px 0 12px; height:40px;}
.menu li a._lk span.down {float:left; display:block; paddg:0 24px 0 12px; height:40px; background:url(images/down.gif) no-repeat right ;}
.menu li a._lk:hover {color:#000; background: url(images/button4.gif) no-repeat;}
.menu li a._lk:hover span {background:url(images/button4.gif) no-repeat right ;}
.menu li a._lk:hover span.down {background:url(images/button4a.gif) no-repeat right ;}
.menu li:hover > a._lk {color:#000; background: url(images/button4.gif) no-repeat;}
.menu li:hover > a._lk span {background:url(images/button4.gif) no-repeat right ;}
.menu li:hover > a._lk span.down {background:url(images/button4a.gif) no-repeat right ;}
.menu table {border-collapse:collapse; width:0; height:0; position:absolute; :0; left:0;}
.menu a:hover {visibility:visible;}
.menu li:hover {position:relative; z-dex:200;}
.menu ul,
.menu :hover ul ul,
.menu :hover ul :hover ul ul,
.menu :hover ul :hover ul :hover ul ul,
.menu :hover ul :hover ul :hover ul :hover ul ul {position:absolute; left:-9999px; :-9999px; width:0; height:0; marg:0; paddg:0; list-style:none;}
.menu :hover ul.sub {left:2px; :40px; right:2px; background: #fff; paddg:3px 0; border:1px solid #999999; white-space:nowrap; width:200px; height:auto;}
.menu :hover ul.sub li {display:block; height:20px; position:relative; float:left; width:250px;}
.menu :hover ul.sub li a {font-weight:normal;display:block; font-size:11px; height:20px; width:192px; le-height:20px; text-dent:5px; color:#000; text-decoration:none; border:3px solid #fff; border-width:0 0 0 3px;}
.menu :hover ul.sub li a.fly {background:#fff url(images/arrow.gif) 80px 7px no-repeat;}
.menu :hover ul.sub li a:hover {background:#999999; color:#fff;}
.menu :hover ul.sub li a.fly:hover {background:#999999 url(images/arrow_over.gif) 80px 7px no-repeat; color:#fff;}
.menu :hover ul li:hover > a.fly {background:#999999 url(images/arrow_over.gif) 80px 7px no-repeat; color:#fff;}
.menu :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul :hover ul,
.menu :hover ul :hover ul :hover ul :hover ul :hover ul
{left:90px; :-4px; background: #fff; paddg:3px 0; border:1px solid 999999; white-space:nowrap; width:93px; z-dex:200; height:auto;}
</style>
</head>
<body>
<div>
<ul class="menu">
<li class=""><a href="#" class="_lk"><span>首页</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的相册</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的日志</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的音乐盒</span></a></li>
<li class=""><a href="#" class="_lk"><span>我的介绍</span></a></li>
<li class=""><a href="#" class="_lk"><span>留言本</span></a></li>
</ul>
</div>
</body>
</html>
希望本文所述对大家的div+css网页设计有所帮助。