织梦纯CSS一级栏目下拉导航菜单代码

织梦html纯CSS一级栏目下拉导航菜单,找了好久没找到满意的,网上的都是从以前DEDECMS5.5版本扒下来的,还要调用JS.整了半天,很多测试调用不出来,我找的这个上纯CSS,不需要修改其他网站文件,现分享给大家。

效果图:

QQ截图20170112134804

样式

body{ font:14px "Microsoft YaHei", Arial,Verdana,tahoma, Srial, helvetica, sans-serif; line-height:1.8; color:#333; background:#fff;}
.menu {height: 40px; background: #4ba036;position: relative; z-index:999;
}
.menu a {
	text-decoration: none;display: block; padding: 0 12px; margin-right: 1px; line-height: 40px; font-size: 16px; color: #fff;
}
ul {
	margin: 0;
	padding: 0;
}
.menu li {
	list-style: none;
	float: left;
	width: 90px;
	overflow: visible;
	cursor: pointer;
}
ul.level0 {
	height: 40px;
	overflow: visible;
}
ul.level1, ul.level2, ul.level3 {
	width: 90px;
	display: none;
}
ul.level2, ul.level3 {
	margin: -28px 0 0 90px;
}
ul.level0 > li {
	height: 40px;
	line-height: 40px;
	text-align: center;
	background: #4ba036;
}
ul.level1 > li, ul.level2 > li, ul.level3 > li {
	height: 40px;
	line-height: 40px;
	background: #308a1a;
}
ul.level0 > li:hover {
	background: #308a1a;
}
ul.level1 > li:hover, ul.level2 > li:hover, ul.level3 > li:hover {
	background: #4ba036;
}
ul.level0 > li.imyeah:hover > ul, ul.level1 > li.imyeah:hover > ul, ul.level2 > li.imyeah:hover > ul, ul.level3 > li.imyeah:hover > ul {
	display: block;
}

调用代码:

<div class="menu">
  <div class="bar">
    <ul class="level0">
      <li><a href="/">首页</a></li>
      {dede:channelartlist typeid="top" row='18' currentstyle="<li class='active'><a href='~typelink~' ~rel~><span>~typename~</span></a></li>"}
      <li class="imyeah"><a href="{dede:field name="typeurl"/}" target="_blank">{dede:field name="typename"/}</a>
        <ul class="level1">
          {dede:channel type="son"}
          <li><a href="[field:typeurl/]" title="[field:typename/]">[field:typename/]</a></li>
          {/dede:channel}
        </ul>
      </li>
      {/dede:channelartlist}
    </ul>
  </div>
</div>

 

THE END