网页设计师联盟

--- 学习、交流、展示、资源

招聘精英个人求职网站发布网友作品网页特效动画欣赏网页素材免费资源源码下载设计软件
作品欣赏       域名申请       虚拟主机
网页设计师

  • 新闻资讯
  • 网页教程
  • 平面教程
  • 程序设计
  • 视频教程
  • Flash教程

网页设计师站提供网页设计程序设计服务 E-mail:liangfeng0526@qq.com

 您当前的位置:首页 > 阅读文章
网页设计师联盟(www.wysjs.cn)欢迎您!
 标题:

css设置的下拉菜单

<!-- 把下列代码加入到head区内 -->
<style type="text/css">

#cssdropdown, #cssdropdown ul {
padding: 0;
margin: 0;
list-style: none;
}

#cssdropdown li {
float: left;
position: relative;
}

.mainitems{
border: 1px solid black;
background-color: #FFEEC6;
}

.mainitems a{
margin-left: 6px;
margin-right: 8px;
text-decoration: none;
}

.subuls{
display: none;
width: 10em;
position: absolute;
top: 1.2em;
left: 0;
background-color: lightyellow;
border: 1px solid black;
}

.subuls li{
width: 100%;
}

.subuls li a{
text-decoration: underline;
}

#cssdropdown li>ul { /* to override top and left in browsers other than IE, which will position to the top right of the containing li, rather than bottom left */
top: auto;
left: auto;
}

#cssdropdown li:hover ul, li.over ul { /* lists nested under hovered list items */
display: block;
}

#restofcontent { /*wrap rest of content of the page inside this div*/
clear: left;
}

</style>

<script type="text/javascript"><!--//--><![CDATA[//><!--
startList = function() {
if (document.all&&document.getElementById) {
cssdropdownRoot = document.getElementById("cssdropdown");
for (i=0; i<cssdropdownRoot.childNodes.length; i++) {
node = cssdropdownRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}

if (window.attachEvent)
window.attachEvent("onload", startList)
else
window.onload=startList;

//--><!]]></script>


<!-- 把下列代码加入到body区内 -->
<ul id="cssdropdown">

<li class="mainitems">
<a href="http://www.wysjs.cn/article.asp?typeid=38">CSS Gallery</a>
<ul class="subuls">
<li><a href="">Gordon Mac</a></li>
<li><a href="">Juiced Thoughts</a></li>
<li><a href="">The Daily Flight</a></li>
<li><a href="">GrapeFruit</a></li>
</ul>
</li>

<li class="mainitems">
<a href="http://www.wysjs.cn/article.asp?typeid=38">CSS Examples</a>
<ul class="subuls" style="width: 15em">
<li><a href="">CSS2 Generated Content</a></li>
<li><a href="">Custom scrollbar colors</a></li>
<li><a href="">Markerless and "no indent" Lists</a></li>
</ul>
</li>

</ul>

  • (刊登方式:转载   来源:网络   作者:   添加:admin   关键词:)
  • 您已阅读:css设置的下拉菜单 您还可以继续阅读↓  或 回到首页看看>>>
  • 上一篇DIV CSS制作的符合标准的网页导航菜单(12)

    <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;chars..

  • 下一篇兰色背景变换的CSS导航菜单

    <!--把下列代码加入到head区内--><style>#button{width:150px;border-right:1pxsolid#000;padding:001em0;margin-bottom:1em;font-family:'TrebuchetMS','LucidaGrande',Arial,sans-serif;font-size:90%;background-color:#90bade;color:#333;} #buttonul{list-style:none;margi..