css刚才没有事;作了一个;不知道合不合标准!代码也没有优化,可能写的有点多!不过在IE和FIREFOX中都测过了;没有问题; 呵呵;
代码(没有优化过的):
程序代码
<style>
/* www.zishu.cn 子鼠 */
#menu{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
border:1px solid #000000;
width:200px;
background-color: #FF9D1F;
text-align:center;
}
#menub{
margin:20px;
}
.w1{
margin:3px;
border-top:1px solid #FFC881;
border-right:1px solid #EE8600;
border-bottom:1px solid #EE8600;
border-left:1px solid #FFC881;
}
.w2{
border-top:1px solid #EE8600;
border-right:1px solid #FFAD42;
border-bottom:1px solid #FFAD42;
border-left:1px solid #EE8600;
}
.w3{
border-top:2px solid #D07500;
border-right:2px solid #FFB85D;
border-bottom:2px solid #FFB85D;
border-left:2px solid #D07500;
}
.w4{
border:1px solid #FC8E00;
}
.w5{
border:1px solid #000000;
}
.w7{
border-top:1px solid #FFDCAF;
border-right:1px solid #C87000;
border-bottom:1px solid #C87000;
border-left:1px solid #FFDCAF;
}
.w8{
border-top:1px solid #FFD7A4;
border-right:1px solid #FF9204;
border-bottom:1px solid #FF9204;
border-left:1px solid #FFD7A4;
}
.w9{
background:#FFC881;
border-top:1px solid #FECE8F;
border-right:1px solid #FFAE44;
border-bottom:1px solid #FFAE44;
border-left:1px solid #FECE8F;
}
#menu a{
color: #884C00;
text-decoration: none;
font-weight: bold;
}
#menu a:hover{background:#FFB85D; color:#000000;}
#menu a:hover .w7 {
border-top:1px solid #C87000;
border-right:1px solid #FFDCAF;
border-bottom:1px solid #FFDCAF;
border-left:1px solid #C87000;
}
#menu a:hover .w8 {
border-top:1px solid #FF9204;
border-right:1px solid #FFD6A1;
border-bottom:1px solid #FFD6A1;
border-left:1px solid #FF9204;
}
#menu a:hover .w9 {
background:#FFB85D;
border-top:1px solid #FFAE44;
border-right:1px solid #FECF91;
border-bottom:1px solid #FECF91;
border-left:1px solid #FFAE44;
}
</style>
BODY:
程序代码
<!-- www.zishu.cn 子鼠-->
<div id="menu">
<div id="menub">
<div class="w1">
<div class="w2">
<div class="w3">
<div class="w4">
<div class="w5"> <a href="http://www.zishu.cn" target="_blank">
<div class="w7">
<div class="w8">
<div class="w9"> www.zishu.cn </div>
</div>
</div>
</a> </div>
</div>
</div>
</div>
</div>
<div class="w1">
<div class="w2">
<div class="w3">
<div class="w4">
<div class="w5"> <a href="http://www.zishu.cn" target="_blank">
<div class="w7">
<div class="w8">
<div class="w9"> www.zishu.cn </div>
</div>
</div>
</a> </div>
</div>
</div>
</div>
</div>
<div class="w1">
<div class="w2">
<div class="w3">
<div class="w4">
<div class="w5"> <a href="http://www.zishu.cn" target="_blank">
<div class="w7">
<div class="w8">
<div class="w9"> www.zishu.cn </div>
</div>
</div>
</a> </div>
</div>
</div>
</div>
</div>
<div class="w1">
<div class="w2">
<div class="w3">
<div class="w4">
<div class="w5"> <a href="http://www.zishu.cn" target="_blank">
<div class="w7">
<div class="w8">
<div class="w9"> www.zishu.cn </div>
</div>
</div>
</a> </div>
</div>
</div>
</div>
</div>
<div class="w1">
<div class="w2">
<div class="w3">
<div class="w4">
<div class="w5"> <a href="http://www.zishu.cn" target="_blank">
<div class="w7">
<div class="w8">
<div class="w9"> www.zishu.cn </div>
</div>
</div>
</a> </div>
</div>
</div>
</div>
</div>
</div>
</div>
HTML代码
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
以下是优化过的代码:
程序代码#menu{font-family: Arial, Helvetica, sans-serif;font-size: 12px;border:1px solid #000;width:200px; background: #FF9D1F;text-align:center;}
.w1,.w2,.w4,.w5,.w7,.w8,.w9{border:1px solid;}
#menub{margin:20px;}
.w1{border-color:#FFC881 #EE8600 #EE8600 #FFC881;margin:3px;}
.w2{border-color:#EE8600 #FFAD42 #FFAD42 #EE8600;}
.w3{border-color:#D07500 #FFB85D #FFB85D #D07500;border-width: 2px;border-style: solid;}
.w4{border-color:#FC8E00;}
.w5{border-color:#000;}
.w7{border-color:#FFDCAF #C87000 #C87000 #FFDCAF;}
.w8{border-color:#FFD7A4 #FF9204 #FF9204 #FFD7A4;}
.w9{border-color:#FECE8F #FFAE44 #FFAE44 #FECE8F;background:#FFC881;}
#menu a{color: #884C00;text-decoration: none;font-weight: bold;}
#menu a:hover{color:#000;}
#menu a:hover .w7 {border-color:#C87000 #FFDCAF #FFDCAF #C87000;}
#menu a:hover .w8 {border-color:#FF9204 #FFD6A1 #FFD6A1 #FF9204;}
#menu a:hover .w9 {border-color:#FFAE44 #FECF91 #FECF91 #FFAE44;background:#FFB85D;}
转载请注明出处:http://www.zishu.cn 子鼠
DIV+CSS作的导航条
80酷酷网 80kuku.com