纯HTML+CSS3制作导航菜单(附源码)


Posted in HTML / CSS onApril 24, 2013

浏览器支持 IE9/GoogleChrome/FireFox/Safari
效果图:
纯HTML+CSS3制作导航菜单(附源码)
代码下载
html代码

复制代码
代码如下:

<!DOCTYPE HTML>
<html>
<head>
<title>纯html+css3导航</title>
<!-- mulder -->
<!-- qq:10221408 -->
<!-- 只支持 chrome firefox -->
<style>
*{
margin:0;
padding:0;
}
.clear:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
nav{
display:inline-block;
border:1px solid #505255;
border-bottom: 1px solid #282C2F;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
margin:50px;
-webkit-box-shadow:1px 1px 3px #292929;
-moz-box-shadow:1px 1px 3px #292929;
}
li{
list-style:none;
float:left;
border-right: 1px solid #2E3235;
position: relative;
/*background: -moz-linear-gradient(top, #fff, #555D5F 2% ,#555D5F 50%,#3E4245 100%);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), color-stop(2%, #555D5F), color-stop(50%, #555D5F),to(#3E4245));*/
background:#555D5F;
}
li:hover{
/*background: -moz-linear-gradient(top, #fff, #3E4245 2% ,#555D5F 80%,#555D5F 100%);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), color-stop(2%, #3E4245), color-stop(80%, #3E4245),to(#555D5F));*/
background:#3E4245;
-moz-transition: background 1s ease-out;
-webkit-transition: background 1s ease-out;
}
li a{
display:block;
height:40px;
line-height:40px;
padding:0 30px;
font-size:12px;
color:#fff;
text-shadow: 0px -1px 0px #000;
text-decoration:none;
white-space:nowrap;
border-left: 1px solid #999E9F;
border-top: 1px solid #999E9F;
-moz-border-top-left-radius: 2px;
-webkit-border-top-left-radius: 2px;
z-index:100;
}
li > a{
position:relative;
}
li.first a{
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
}
li.last{
border-right: 0 none;
}
dl{
position:absolute;
display:block;
top:40px;
left: -25px;
width:165px;
background:#222222;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-webkit-box-shadow:1px 1px 3px #292929;
-moz-box-shadow:1px 1px 3px #292929;
z-index:10;
}
li:hover dl{
top:50px;
display:block;
width:145px;
padding:10px;
}
dl a{
background:transparent;
border:0 none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-transition: background 0.5s ease-out;
-webkit-transition: background 0.5s ease-out;
z-index:50;
}
dl a:hover{
color:#FFF;
background:#999E9F;
-moz-transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
-webkit-transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
}
dd{
margin-top:-40px;
opacity:0;
width:145px;
-webkit-transition-property:all;
/*-webkit-transition-timing-function: cubic-bezier(5,0,5,0);*/
-moz-transition-property: all;
/*-moz-transition-timing-function: cubic-bezier(5,0,5,0);*/
/*-webkit-transition-delay:5s;
-moz-transition-delay:5s;*/
}
li:hover dd{
margin-top:0;
opacity:1;
}
li dd:nth-child(1){
-webkit-transition-duration: 0.1s;
-moz-transition-duration: 0.1s;
}
li dd:nth-child(2){
-webkit-transition-duration: 0.2s;
-moz-transition-duration: 0.2s;
}
li dd:nth-child(3){
-webkit-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
}
li dd:nth-child(4){
-webkit-transition-duration: 0.4s;
-moz-transition-duration: 0.4s;
}
dt{
display:none;
margin-top:-25px;
padding-top:15px;
height:10px;
}
li:hover dt{
display:block;
}
.Darrow{
float:right;
margin:18px 10px 0 0;
border-width:5px;
border-color:#FFF transparent transparent transparent;
border-style:solid;
width:0;
height:0;
line-height:0;
overflow:hidden;
cursor:pointer;
text-shadow: 0px -1px 0px #000;
-webkit-box-shadow:0px -1px 0px #000;
-moz-box-shadow:0px -1px 0px #000;
}
.arrow{
margin:0 auto;
margin-top:-5px;
display:block;
width:10px;
height:10px;
background:#222222;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
}
</style>
</head>
<body>
<nav>
<ul class="clear">
<li class="first"><a href="#">菜单一</a></li> _fcksavedurl=""#">菜单一</a></li>"
<li>
<span class="Darrow"></span>
<a href="#">菜单二</a>
<dl>
<dt><span class="arrow"></span></dt>
<dd><a href="#">子菜单一</a></dd>
<dd><a href="#">子菜单二</a></dd>
<dd><a href="#">子菜单三子菜单三</a></dd>
</dl>
</li>
<li>
<span class="Darrow"></span>
<a href="#">菜单三</a>
<dl>
<dt><span class="arrow"></span></dt>
<dd><a href="#">子菜单一</a></dd>
<dd><a href="#">子菜单二</a></dd>
<dd><a href="#">子菜单三子菜单三</a></dd>
</dl>
</li>
<li>
<span class="Darrow"></span>
<a href="#">菜单四</a>
<dl>
<dt><span class="arrow"></span></dt>
<dd><a href="#">子菜单一</a></dd>
<dd><a href="#">子菜单二</a></dd>
<dd><a href="#">子菜单三</a></dd>
<dd><a href="#">子菜单四</a></dd>
</dl>
</li>
<li><a href="#">菜单五</a></li>
<li><a href="#">菜单六</a></li>
<li><a href="#">菜单七</a></li>
<li class="last"><a href="#">菜单八</a></li>
</ul>
</nav>
</body>
</html>
HTML / CSS 相关文章推荐
收集的22款给力的HTML5和CSS3帮助工具
Sep 14 HTML / CSS
用CSS3实现无限循环的无缝滚动的示例代码
Nov 01 HTML / CSS
css3 实现滚动条美化效果的实例代码
Jan 06 HTML / CSS
CSS3 真的会替代 SCSS 吗
Mar 09 HTML / CSS
详解HTML5中垂直上下居中的解决方案
Dec 20 HTML / CSS
html5中canvas学习笔记1-画板的尺寸与实际显示尺寸
Jan 06 HTML / CSS
html5 css3实例教程 一款html5和css3实现的小机器人走路动画
Oct 20 HTML / CSS
借助HTML5 Canvas API制作一个简单的猜字游戏
Mar 25 HTML / CSS
Html5 Geolocation获取地理位置信息实例
Dec 09 HTML / CSS
移动HTML5前端框架—MUI的使用
Dec 18 HTML / CSS
CSS几步实现赛博朋克2077风格视觉效果
Jun 16 HTML / CSS
html form表单基础入门案例讲解
Jul 15 HTML / CSS
Css3+Js制作漂亮时钟(附源码)
Apr 24 #HTML / CSS
CSS3盒子模型详解
Apr 24 #HTML / CSS
CSS3盒子模型详解
Apr 24 #HTML / CSS
css3闪亮进度条效果实现思路及代码
Apr 17 #HTML / CSS
关于CSS Tooltips(鼠标经过时显示)的效果
Apr 10 #HTML / CSS
用CSS3实现Win8风格的方格导航菜单效果
Apr 10 #HTML / CSS
纯css3(无图片/js)制作的几个社交媒体网站的图标
Mar 21 #HTML / CSS
You might like
Zerg兵种介绍
2020/03/14 星际争霸
php数组查找函数总结
2014/11/18 PHP
PHP cURL初始化和执行方法入门级代码
2015/05/28 PHP
tp5(thinkPHP5框架)时间查询操作实例分析
2019/05/29 PHP
laravel框架与其他框架的详细对比
2019/10/23 PHP
JavaScript 解析Json字符串的性能比较分析代码
2009/12/16 Javascript
JavaScript window.document的属性、方法和事件小结
2012/10/24 Javascript
jQuery瀑布流插件Wookmark使用实例
2014/04/02 Javascript
js调试系列 源码定位与调试[基础篇]
2014/06/18 Javascript
一个简单的全屏图片上下打开显示网页效果示例
2014/07/08 Javascript
JQuery右键菜单插件ContextMenu使用指南
2014/12/19 Javascript
JavaScript 定时器 SetTimeout之定时刷新窗口和关闭窗口(代码超简单)
2016/02/26 Javascript
漫谈JS引擎的运行机制 你应该知道什么
2016/06/15 Javascript
jquery 属性选择器(匹配具有指定属性的元素)
2016/09/06 Javascript
JS检测数组类型的方法小结
2017/03/14 Javascript
浅谈Angular2 模块懒加载的方法
2017/10/04 Javascript
详解如何使用router-link对象方式传递参数?
2019/05/02 Javascript
layui表单提交到后台自动封装到实体类的方法
2019/09/12 Javascript
解决vue请求接口第一次成功,第二次失败问题
2020/09/08 Javascript
巧用python和libnmapd,提取Nmap扫描结果
2016/08/23 Python
Python进阶_关于命名空间与作用域(详解)
2017/05/29 Python
python实现生命游戏的示例代码(Game of Life)
2018/01/24 Python
python 限制函数调用次数的实例讲解
2018/04/21 Python
解决pandas 作图无法显示中文的问题
2018/05/24 Python
matplotlib quiver箭图绘制案例
2020/04/17 Python
在keras中实现查看其训练loss值
2020/06/16 Python
用Python 执行cmd命令
2020/12/18 Python
澳大利亚实惠时尚女装商店:Katies
2019/06/16 全球购物
UNOde50美国官网:西班牙珠宝品牌
2020/08/15 全球购物
Java里面Pass by value和Pass by Reference是什么意思
2016/05/02 面试题
建筑专业毕业生求职信
2014/09/30 职场文书
行政诉讼答辩状
2015/05/21 职场文书
小学运动会前导词
2015/07/20 职场文书
golang协程池模拟实现群发邮件功能
2021/05/02 Golang
游戏《我的世界》澄清Xbox版暂无计划加入光追
2022/04/03 其他游戏
Python按顺序遍历并读取文件夹中文件
2022/04/29 Python