纯css仿淘宝导航下拉菜单的例子

发布时间:2019-11-21编辑:脚本学堂
分享一个纯css下拉菜单代码,纯css仿淘宝导航下拉菜单实例代码,需要的朋友参考下。

css仿淘宝导航下拉菜单,演示效果截图:推荐:css下拉菜单
css仿淘宝导航下拉菜单

css仿淘宝导航菜单
用到的图片
css仿淘宝导航下拉菜单

1,css代码(下拉菜单)
 

复制代码 代码示例:
<style>
body{ font-size:12px; text-align:center;  margin-top:30px; font-family:Verdana;}
div,img{margin:0; padding:0; border:0;}
ul,li{list-style-type: none; margin:0; padding:0; float:left; }
#info{ margin-left:auto; margin-right:auto;width:760px; text-align:left;}
#new{ margin-top:-12px;position: absolute;margin-left:-12px;}
#nav{ height:30px; width:610px; margin-left:auto; margin-right:auto;}
#nav li{margin-left:1px; height:30px;}
#nav li a{ display:block;float:left; text-decoration:none;
background-image: url(r200652134132.gif);background-repeat: no-repeat;
display:block; background-position:left top;}
#nav a span{cursor:hand; color:#000;
background-image: url(v200652134115.gif);background-repeat: no-repeat;
display:block;background-position: right top;
padding:7px 10px 6px 10px; float:left; }
#nav li a:active,#nav li a:hover {margin-top:0px; }
#nav li  a:active span,#nav li a:hover span {padding:10px 10px 6px 10px;
margin-top:0px; display:block; color:#FFF;}
#navigation01 a:link,#navigation01 a:visited {background-position: 0px -27px;}
#navigation01 a:link span,#navigation01 a:visited span{
background-position:right -27px;padding:10px 10px 6px 10px;
margin-top:0; color:#FFF; font-weight:bold;}
#navigation02 a,#navigation03 a,#navigation04 a,#navigation05 a,#navigation06 a,#navigation07
a,#navigation08 a,#navigation09 a,#navigation10 a,#navigation11 a{margin-top:3px;}
#navigation02 a:active,#navigation02 a:hover {background-position: 0px -57px;}
#navigation02 a:active span,#navigation02 a:hover span{background-position:right -57px;}
#navigation03 a:active,#navigation03 a:hover {background-position: 0px -87px;}
#navigation03 a:active span,#navigation03 a:hover span{background-position:right -87px;}
#navigation04 a:active,#navigation04 a:hover {background-position: 0px -117px;}
#navigation04 a:active span,#navigation04 a:hover span{background-position:right -117px;}
#navigation05 a:active,#navigation05 a:hover {background-position: 0px -147px;}
#navigation05 a:active span,#navigation05 a:hover span{background-position:right -147px;}
#navigation06 a:active,#navigation06 a:hover {background-position: 0px -177px;}
#navigation06 a:active span,#navigation06 a:hover span{background-position:right -177px;}
#navigation07 a:active,#navigation07 a:hover {background-position: 0px -207px;}
#navigation07 a:active span,#navigation07 a:hover span{background-position:right -207px;}
#navigation08 a:active,#navigation08 a:hover {background-position: 0px -237px;}
#navigation08 a:active span,#navigation08 a:hover span{background-position:right -237px;}
#navigation09 a:active,#navigation09 a:hover {background-position: 0px -267px;}
#navigation09 a:active span,#navigation09 a:hover span{background-position:right -267px;}
#navigation10 a:active,#navigation10 a:hover {background-position: 0px -297px;}
#navigation10 a:active span,#navigation10 a:hover span{background-position:right -297px;}
#navigation11 a:link span,#navigation11 a:visited span{color:#FF6600;}
#navigation11 a:active,#navigation11 a:hover {background-position: 0px -327px;}
#navigation11 a:active span,#navigation11 a:hover span{background-position:right -327px;}
#menu{ width:760px; height:26px; background:#FF9900;}
#r1{border-top: 0px;border-bottom: 0px; border-left:3px solid #fff;
border-right:3px solid #fff; height:1px; overflow:hidden;}
#r2{border-top: 0px;border-bottom: 0px; border-left:2px solid #fff;
border-right:2px solid #fff; height:1px; overflow:hidden;}
#r3{border-top: 0px;border-bottom: 0px; border-left:1px solid #fff;
border-right:1px solid #fff; height:1px; overflow:hidden;}
</style>

2,html部分
 

复制代码 代码示例:
<div id="info">
 <div id="nav">
  <ul>
   <li id="navigation01"><a href="http://www.yuju100.com"><span>首页</span></a></li>
   <li id="navigation02"><a href="http://www.yuju100.com"><span>数码通讯</span></a></li>
   <li id="navigation03"><a href="http://www.yuju100.com"><span>女人</span></a></li>
   <li id="navigation04"><a href="http://www.yuju100.com"><span>男人</span></a></li>
   <li id="navigation05"><a href="http://www.yuju100.com"><span>家居</span></a></li>
   <li id="navigation06"><a href="http://www.yuju100.com"><span>书籍音像</span></a></li>
   <li id="navigation07"><a href="http://www.yuju100.com"><span>运动</span></a></li>
   <li id="navigation08"><a href="http://www.yuju100.com"><span>游戏</span></a></li>
   <li id="navigation09"><a href="http://www.yuju100.com"><span>宠物</span></a></li>
   <li id="navigation10"><a href="http://www.yuju100.com"><span>香港街</span></a></li>
   <li id="navigation11"><a href="http://www.yuju100.com"><span>865171</span></a></li>
   <li><div id="new"><img src="x200652135342.gif" alt="新加栏目" /></div></li>
  </ul>
 </div>
 <div id="menu">
  <div id="r1"></div>
  <div id="r2"></div>
  <div id="r3"></div>
  <div></div>
 </div>
</div>
<h3>仿淘宝网首页导航条效 www.yuju100.com</h3>