纯CSS+XHTML如何实现的二级导航菜单效果

也许你想成为太阳,可你却只是一颗星辰;也许你想成为大树,可你却是一棵小草。于是,你有些自卑。其实,你和别人一样,也是一片风景:做不了太阳,就做星辰,在自我的星座发光发热;做不了大树,就做小草,以自我的绿色装点期望……

本文实例讲述了纯CSS+XHTML实现的二级导航菜单效果。分享给大家供大家参考。具体如下:

这是一款简约、兼容好的XHTML+css二级导航菜单

运行效果截图如下:

在线演示地址如下:

http://demo.haodaima.com/js/2015/css-xhtml-2l-menu-nav-demo-codes/

具体代码如下:

复制代码
代码如下:

<!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=utf-8" />
<title>纯CSS+XHTML下拉菜单</title>
<style type="text/css">
<!--
* {
margin:0;
padding:0;
}
body {
font:12px Verdana, Geneva, sans-serif #333;
line-height:1.5;
}
ul li {
list-style:none;
}
.menu {
width:660px;
margin:20px auto;
}
.menu li {
display:inline;
float:left;
margin:0 5px;
background:#f2f2f2;
border:1px #39c solid;
text-align:center;
font-size:14px;
font-weight:700;
line-height:30px;
cursor:hand;
}
.tuckUp {
display:inline;
width:120px;
height:30px;
overflow:hidden;
background:#f2f2f2;
}
.pullDown{
display:inline;
height:auto;
}
.item a:link, .item a:visited {
display:inline;
float:left;
width:110px;
background:#ccc;
text-align:center;
color:#444;
font-size:12px;
font-weight:normal;
text-decoration:none;
line-height:25px;
margin:0 5px 5px 5px;
}
.item a:hover {
display:inline;
float:left;
background:#39c;
width:100px;
color:#FFF;
text-decoration:none;
text-align:center;
font-size:12px;
font-weight:700;
font-weight:normal;
line-height:25px;
padding:0 0 0 10px;
margin:0 5px 5px 5px;
}
//
-->
</style>
</head>
<body>
<ul class="menu">
<li class="tuckUp" onmousemove="this.className='pullDown'" onmouseout="this.className='tuckUp'">精品特效
<div class="item"><a rel="nofollow noopener noreferrer" href="#">网页特效</a></a>
<a rel="nofollow noopener noreferrer" href="#">层和布局</a></a>
<a rel="nofollow noopener noreferrer" href="#">表单按钮</a>
</div>
</li>
<li class="tuckUp" onmouseover="this.className='pUllDown'" onmouseout="this.className='tuckUp'">菜单导航
<div class="item"><a rel="nofollow noopener noreferrer" href="#">菜单导航</a>
<a rel="nofollow noopener noreferrer" href="#">CSS菜单</a>
<a rel="nofollow noopener noreferrer" href="#">JQUERY菜单</a>
</div>
</li>
<li class="tuckUp" onmouseover="this.className='pullDown'" onmouseout="this.className='tuckUp'">源代码
<div class="item" ><a rel="nofollow noopener noreferrer" href="#">源码下载</a>
<a rel="nofollow noopener noreferrer" href="#">ASP分类</a>
<a rel="nofollow noopener noreferrer" href="#">PHP分类</a>
<a rel="nofollow noopener noreferrer" href="#">ASP.NET</a>
</div>
</li>
<li class="tuckUp" onmouseover="this.className='pUllDown'" onmouseout="this.className='tuckUp'">更新汇总
<div class="item"><a rel="nofollow noopener noreferrer" href="#">最新更新</a>
<a rel="nofollow noopener noreferrer" href="#">最新更新</a>
<a rel="nofollow noopener noreferrer" href="#">网站首页</a>
</div>
</li>
<li class="tuckUp" onmouseover="this.className='pUllDown'" onmouseout="this.className='tuckUp'">脚本下载
<div class="item"><a rel="nofollow noopener noreferrer" href="#">脚本资源</a>
<a rel="nofollow noopener noreferrer" href="#">AJAX</a>
<a rel="nofollow noopener noreferrer" href="#">JQUERY</a>
<a rel="nofollow noopener noreferrer" href="#">EXTJS</a>
</div>
</li>
</ul>
</body>
</html>

希望本文所述对大家的CSS网页设计有所帮助。

以上就是纯CSS+XHTML如何实现的二级导航菜单效果。考研不是无间道,而且开往春天的地铁!更多关于纯CSS+XHTML如何实现的二级导航菜单效果请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
css让页脚保持在底部位置的四种方案

CSS如何使用Flex和Grid布局如何实现3D骰子

Flex布局史上最简单使用语法教程

新的CSS 伪类函数 :is() 和 :where()示例详解

纯CSS打字动画的如何实现示例