当前位置:编程学习 > JS >>

CSSplay网站的二级滑动菜单

这是来自CSSPlay网站的菜单,在国外经常见到这种菜单,风格总感觉不像是国内的,可能这就是国与国之间的差别吧。或许她正好适合你的网站风格呢!老外的菜单兼容性都做的不错,一般情况下,在IE6/IE7/IE8以及火狐等主流浏览器下显示都没有大问题,代码中加有注释,那就是为适应不同浏览器而加的,你可以根据情况修改。
答案:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>滑动菜单-CSSplay</title>
</head>
<style type="text/css">
 body {
background: #fff;
font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
font-size: 12px;
}
#nav {margin:20px 0 80px 0;}
#nav {float:left; padding-left:10px; width:740px; height:auto; background:#fff url("/jscss/demoimg/200906/_bottom_line.gif") repeat-x bottom; position:relative;}
#nav .select, #nav .current {margin:0; padding:0; list-style:none; display:block;}
#nav li {display:inline; margin:0; padding:0;height:auto;}
#nav .select a,
#nav .current a {display:block; height:21px; float:left; background:url("/jscss/demoimg/200906/_left_both.gif") no-repeat left top; padding:0 0 0 3px; border-bottom:1px solid #000; text-decoration:none; font-size:12px; line-height:20px; white-space:nowrap; font-weight:normal; margin-left:5px;}
* html #nav .select a, * html #nav .current a {width:1px;}
#nav .select a b, 
#nav .current a b {height:100%; display:block; background:url("/jscss/demoimg/200906/_right_both.gif") no-repeat right top; padding:0 9px 0 6px; color:#000; font-weight:normal;}
#nav .select a:hover, 
#nav .select li:hover a {background-position:0 -75px; border-color:#6f9c6f; cursor:pointer;}
#nav .select a:hover b, 
#nav .select li:hover a b {background-position:100% -75px; border-color:#6f9c6f; color:#ff0;}
#nav .sub {display:none;}
#nav table {position:absolute; border-collapse:collapse; left:0; top:0; font-size:11px;}
#nav .current a {background-position:0 -75px; border-color:#6f9c6f;}
#nav .current a b {background-position:100% -75px; color:#ff0;}
#nav .sub li a:hover, 
#nav .select a:hover .sub li a:hover, 
#nav .select li:hover .sub li a:hover {background:#6f9c6f url(/jscss/demoimg/200906/_sub_back_on.gif) top right no-repeat; color:#ff0;}
#nav .sub_active .current_sub a, 
#nav .sub_active a:hover {background:#6f9c6f url(/jscss/demoimg/200906/_sub_back_on.gif) top right no-repeat;; color:#ff0;}
#nav .select li a:hover .sub, 
#nav .select li:hover .sub {display:block; position:absolute; width:750px; top:21px; left:0; background:#6f9c6f url(/jscss/demoimg/200906/_sub_back.gif); margin-top:1px; padding:0 0 20px 0; z-index:100; color:#000;}
#nav .sub, #nav .sub_active {margin:0; padding:0; list-style:none;}
#nav .sub_active {display:block; position:absolute; width:750px; top:21px; left:0; background:#6f9c6f url(/jscss/demoimg/200906/_sub_back.gif); margin-top:1px; padding:0 0 20px 0; z-index:10; color:#000;}
* html #nav .sub_active, * html #nav .select a:hover .sub {z-index:-1; margin-top:0; margin-t\op:1px;}
#nav .sub_active a {height:21px; float:left; text-decoration:none; line-height:20px; white-space:nowrap; font-weight:normal;}
#nav .sub_active a, 
#nav .select a:hover .sub li a, 
#nav .select li:hover .sub li a {display:inline; background:#6f9c6f url(/jscss/demoimg/200906/_sub_back_off.gif) top right; padding:0 20px; margin:0; font-size:12px; width:auto; white-space:nowrap; font-weight:normal; border:0; color:#000;}
</style>
<body>
<div id="nav">
<ul class="select"><li><a href="#"><b>滑动式菜单</b>
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul class="sub"><li><a href="#">下大雨了</a></li>
<li><a href="#">收衣服啦</a></li>
<li><a href="#">老婆还在外头</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li></ul>
<ul class="current"><li><a href="#"><b>你的菜单</b>
</a></li></ul><ul class="sub_active">
<li><a href="#">演示</a></li>
<li><a href="#">下载</a></li>
<li><a href="#">文档</a></li>
</ul>
<ul class="select"><li><a href="#"><b>英文文字</b>
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul class="sub"><li><a href="#">The Girl with Green Eyes</a></li>
<li><a href="#">Woman in Blue</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li></ul>

<ul class="select"><li><a href="#"><b>生活广场</b>
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul class="sub"><li><a href="#">编程乐园</a></li>
<li><a href="#">时尚之都</a></li>
<li><a href="#">老婆漂亮</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li></ul>
</div>

</body>
</html>

上一个:JS+CSS打造另类带提示的竖向导航菜单
下一个:仿QQ折叠菜易做图滑型(JS+css)

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,