您的位置:首页 > Web前端 > CSS

css导航菜单(包含横向子菜单)

2010-01-27 12:36 477 查看
强烈推荐一款CSS导航菜单,用到政府学校类网站上超级不错。

有点类似站长网菜单的味道,只不过颜色不一样而已,这种菜单还不是真正意义上的“下拉”菜单,应该叫滑出菜单
<!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>导航菜单</title>
<mce:style><!--
body,td,th {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
color: #333333;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a {
color: #333333;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: none;
}
a:active{
color: #FF0000;
text-decoration: none;
}
#menu{
height:32px;
margin-top:8px; background-color:#990000;
}
#menu ul{
margin:auto; width:778px; height:32px;
list-style-type:none; padding:0px; margin-top:0px; margin-bottom:0px;
}
.m_li{
float:left; width:114px; line-height:32px;  text-align:center; margin-right:-2px; margin-left:-2px;
}
.m_li a{
display:block; color:#FFFFFF; width:114px;
}
.m_line{
float:left; width:1px; height:32px;
line-height:32px;   /*ff下有效(图片垂直居中)*/
}
.m_line img{
margin-top:expression(( 32 - this.height ) / 2);   /*ie下有效(图片垂直居中)*/
}
.m_li_a{
float:left; width:114px; line-height:32px; text-align:center; padding-top:3px; font-weight:bold;
background-image:url(http://www.codefans.net/jscss/demoimg/200904/menu_bg2.jpg); position:relative; height:32px; margin-top:-3px; margin-right:-2px; margin-left:-2px;
}
.m_li_a a{
display:block; color:#FF0000; width:114px;
}
.smenu{
width:774px; margin:0px auto 0px auto; padding:0px; list-style-type:none; height:32px;
}
.s_li{
line-height:32px; width:auto; display:none; height:32px;
}
.s_li_a{
line-height:32px; width:auto; display:block; height:32px;
}
--></mce:style><style mce_bogus="1">body,td,th {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 12px;
color: #333333;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a {
color: #333333;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: none;
}
a:active{
color: #FF0000;
text-decoration: none;
}
#menu{
height:32px;
margin-top:8px; background-color:#990000;
}
#menu ul{
margin:auto; width:778px; height:32px;
list-style-type:none; padding:0px; margin-top:0px; margin-bottom:0px;
}
.m_li{
float:left; width:114px; line-height:32px;  text-align:center; margin-right:-2px; margin-left:-2px;
}
.m_li a{
display:block; color:#FFFFFF; width:114px;
}
.m_line{
float:left; width:1px; height:32px;
line-height:32px;   /*ff下有效(图片垂直居中)*/
}
.m_line img{
margin-top:expression(( 32 - this.height ) / 2);   /*ie下有效(图片垂直居中)*/
}
.m_li_a{
float:left; width:114px; line-height:32px; text-align:center; padding-top:3px; font-weight:bold;
background-image:url(http://www.codefans.net/jscss/demoimg/200904/menu_bg2.jpg); position:relative; height:32px; margin-top:-3px; margin-right:-2px; margin-left:-2px;
}
.m_li_a a{
display:block; color:#FF0000; width:114px;
}
.smenu{
width:774px; margin:0px auto 0px auto; padding:0px; list-style-type:none; height:32px;
}
.s_li{
line-height:32px; width:auto; display:none; height:32px;
}
.s_li_a{
line-height:32px; width:auto; display:block; height:32px;
}</style>
<mce:script type="text/javascript"><!--
//初始化
var def="1";
function mover(object){
//主菜单
var mm=document.getElementById("m_"+object);
mm.className="m_li_a";
//初始主菜单隐藏效果
if(def!=0){
var mdef=document.getElementById("m_"+def);
mdef.className="m_li";
}
//子菜单
var ss=document.getElementById("s_"+object);
ss.style.display="block";
//初始子菜单隐藏效果
if(def!=0){
var sdef=document.getElementById("s_"+def);
sdef.style.display="none";
}
}
function mout(object){
//主菜单
var mm=document.getElementById("m_"+object);
mm.className="m_li";
//初始主菜单
if(def!=0){
var mdef=document.getElementById("m_"+def);
mdef.className="m_li_a";
}
//子菜单
var ss=document.getElementById("s_"+object);
ss.style.display="none";
//初始子菜单
if(def!=0){
var sdef=document.getElementById("s_"+def);
sdef.style.display="block";
}
}
// --></mce:script>
</head>
<body>
<div id="menu">
<ul>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_1" class='m_li_a'><a href="#" mce_href="#">财税首页</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_2" class='m_li' onmouseover='mover(2);' onmouseout='mout(2);'><a href="#" mce_href="#">政务公开</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_3" class='m_li' onmouseover='mover(3);' onmouseout='mout(3);'><a href="#" mce_href="#">网上办事</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_4" class='m_li' onmouseover='mover(4);' onmouseout='mout(4);'><a href="#" mce_href="#">公告中心</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_5" class='m_li' onmouseover='mover(5);' onmouseout='mout(5);'><a href="#" mce_href="#">法规中心</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_6" class='m_li' onmouseover='mover(6);' onmouseout='mout(6);'><a href="#" mce_href="#">财税文化</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
<li id="m_7" class='m_li' onmouseover='mover(7);' onmouseout='mout(7);'><a href="#" mce_href="#">专题宣传</a></li>
<li class="m_line"><img src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" mce_src="http://www.codefans.net/jscss/demoimg/200904/line2.gif" /></li>
</ul>
</div>
<div style="height:32px; background-color:#F1F1F1;">
<ul class="smenu">
<li style="padding-left:29px;" mce_style="padding-left:29px;" id="s_1" class='s_li_a'>欢迎光临源码爱好者,您是本站第13122842位爱好者!</li>
<li style="padding-left:141px;" mce_style="padding-left:141px;" id="s_2" class='s_li' onmouseover='mover(2);' onmouseout='mout(2);'><a href="/" mce_href="">财税简介</a>  |  <a href="http://www.codefans.net" mce_href="http://www.codefans.net">机构设置</a>  |& amp;nbsp; <a href="/" mce_href="">办事指南</a>  |  <a href="/" mce_href="">税种简介</a>  |  <a href="/" mce_href="">财税动态</a>  |  <a href="/" mce_href="">网页特效</a></li>
<li style="padding-left:252px;" mce_style="padding-left:252px;" id="s_3" class='s_li' onmouseover='mover(3);' onmouseout='mout(3);'><a href="/" mce_href="">下载专区</a>  |  <a href="/" mce_href="">上传专区</a>  |  <a href="http://codefans.net" mce_href="http://codefans.net">申请报名</a>  |& nbsp; <a href="http://codefans.net" mce_href="http://codefans.net">查询系统</a>  |& nbsp; <a href="http://www.codefans.net" mce_href="http://www.codefans.net">咨询投诉</a>  |& amp;nbsp; <a href="/" mce_href="">满意调查</a></li>
<li style="padding-left:362px;" mce_style="padding-left:362px;" id="s_4" class='s_li' onmouseover='mover(4);' onmouseout='mout(4);'><a href="/" mce_href="">最新公告</a>  |  <a href="/" mce_href="">会计通知</a></li>
<li style="padding-left:474px;" mce_style="padding-left:474px;" id="s_5" class='s_li' onmouseover='mover(5);' onmouseout='mout(5);'><a href="/" mce_href="">最新政策</a>  |  <a href="http://www.codefans.net" mce_href="http://www.codefans.net">政策法规查询</a></li>
<li style="padding-left:447px;" mce_style="padding-left:447px;" id="s_6" class='s_li' onmouseover='mover(6);' onmouseout='mout(6);'><a href="/" mce_href="">税收宣传</a>  |  <a href="/" mce_href="">最新更新</a>  |  <a href="http://codefans.net" mce_href="http://codefans.net">文明创建</a>  |& nbsp; <a href="http://codefans.net" mce_href="http://codefans.net" target="_blank">青年论坛</a>  | & nbsp;<a href="#" mce_href="#">廉政课堂</a></li>
<li style="padding-left:696px;" mce_style="padding-left:696px;" id="s_7" class='s_li' onmouseover='mover(7);' onmouseout='mout(7);'><a href="/" mce_href="">专题宣传区</a></li>
</ul>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: