一款纯css3实现的动画加载导航_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:56:47
原创
1271人浏览过

之前为大家介绍了好几款导航菜单,今天为给大家再带来一款纯css3实现的动画加载导航。该导航出现的时候以动画的形式出现。效果图如下:

在线预览   源码下载

实现的代码。

html代码:

立即学习前端免费学习笔记(深入)”;

 <ul class="main-menu">        <li class="main-menu-item active"><a href="#">Home</a></li><li class="main-menu-item">            <a href="#">About Us</a></li><li class="main-menu-item"><a href="#">Another Link</a></li><li                class="main-menu-item"><a href="#">And another</a></li><li class="main-menu-item"><a                    href="#">Stuff</a></li><li class="main-menu-item"><a href="#">Help</a></li><li class="main-menu-item">                        <a href="#">Contact</a></li></ul>
登录后复制

css代码:

   *, *:after, *:before {  -moz-box-sizing: border-box;       box-sizing: border-box;  margin: 0;  padding: 0;}html, body {  background: #f0f0f0;  font-family: Helvetica, sans-serif;  height: 100%;}.main-menu {  margin: auto;  width: 960px;  text-align: center;  position: relative;  list-style-type: none;  margin-top: 2em;}.main-menu::after,.main-menu-item.active::after {  content: '';  display: inline-block;  position: absolute;}.main-menu::after {  width: 70%;  height: 2px;  background: #9B1C27;  -webkit-animation: menuLine 1s ease forwards;          animation: menuLine 1s ease forwards;  -webkit-transform: scaleX(0);      -ms-transform: scaleX(0);          transform: scaleX(0);  bottom: 0;  left: 0;  right: 0;  margin: auto;  opacity: 0;}@-webkit-keyframes menuLine {  to {    -webkit-transform: scaleX(1);            transform: scaleX(1);    opacity: 1;  }}@keyframes menuLine {  to {    -webkit-transform: scaleX(1);            transform: scaleX(1);    opacity: 1;  }}@-webkit-keyframes menuItem {  to {    -webkit-transform: translateY(0);            transform: translateY(0);    opacity: 1;  }}@keyframes menuItem {  to {    -webkit-transform: translateY(0);            transform: translateY(0);    opacity: 1;  }}.main-menu-item a {  display: block;  padding: 1em;  text-decoration: none;  color: #555;  opacity: 0;  -webkit-transform: translateY(40%);      -ms-transform: translateY(40%);          transform: translateY(40%);  -webkit-animation: menuItem .8s ease forwards;          animation: menuItem .8s ease forwards;  -webkit-transition: all .2s ease;          transition: all .2s ease;}.main-menu-item:nth-child(4) a {  -webkit-animation-delay: .4s;          animation-delay: .4s;}.main-menu-item:nth-child(3) a, .main-menu-item:nth-child(5) a {  -webkit-animation-delay: .5s;          animation-delay: .5s;}.main-menu-item:nth-child(2) a, .main-menu-item:nth-child(6) a {  -webkit-animation-delay: .6s;          animation-delay: .6s;}.main-menu-item:nth-child(1) a, .main-menu-item:nth-child(7) a {  -webkit-animation-delay: .7s;          animation-delay: .7s;}.main-menu-item {  display: inline-block;  position: relative;}.main-menu-item:hover a, .main-menu-item.active {  color: #9B1C27;}.main-menu-item:hover a::after, .main-menu-item.active::after {  width: 0;  height: 0;  border-bottom: .5em solid #9B1C27;  border-left: .5em solid transparent;  border-right: .5em solid transparent;  bottom: 0;  left: 0;  right: 0;  margin: auto;  opacity: 0;  -webkit-transform: translateY(0.05em);      -ms-transform: translateY(0.05em);          transform: translateY(0.05em);  -webkit-animation: menuItem .8s 1.2s ease forwards;          animation: menuItem .8s 1.2s ease forwards;}
登录后复制

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号