您现在的位置是:网站首页> 编程资料编程资料
一款纯css3实现的动画加载导航css3中transform属性实现的4种功能详解CSS3.0(Cascading Style Sheet) 层叠级联样式表纯CSS3实现div按照顺序出入效果CSS3实现列表无限滚动/轮播效果css3 利用transform-origin 实现圆点分布在大圆上布局及旋转特效CSS3实现的侧滑菜单CSS3实现的3D隧道效果用CSS3画一个爱心css3 实现文字闪烁效果的三种方式示例代码六种css3实现的边框过渡效果
2021-09-06
949人已围观
简介 这篇文章主要为大家介绍了用css3实现的动画加载导航,该导航出现的时候以动画的形式出现,下面请和的小编一起来学习一下
今天为给大家再带来一款纯css3实现的动画加载导航。该导航出现的时候以动画的形式出现。效果图如下:
html代码:
复制代码
代码如下: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;
}
-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;
}
相关内容
- CSS Hack技术介绍及常用的Hack技巧集锦10个必备的CSS技巧总结要知道的10个CSS技巧最常用和实用的CSS技巧 21个神奇的CSS技巧网页制作中应用的50个CSS技巧(国外)CSS技巧:IE6用import导入CSS的问题书写CSS的5个小技巧让你的样式更规范CSS hack技巧之IE6,IE7,firefox显示不同效果IE6、IE7和FF的最简单的hack技巧-CSS教程-网页制作-网页教学网CSS常用技巧之CSS书写技巧和CSS HACK技巧
- css3 transform属性详解CSS3中的transform属性进行2D和3D变换的基本用法css3中transform属性实现的4种功能
- IE9下DIV本来应该居中的结果显示为居左不定宽高的文字在div中垂直居中实现方法关于div中img,span垂直居中的问题让Div实现水平或垂直居中的相关方法div中内容上下居中小结css中position:fixed实现div在窗口上下左右居中css中position:fixed实现div居中上下左右居中DIV+CSS中让布局、背景图片、文字内容居中的方法DIV+CSS垂直居中一个浮动元素CSS实现DIV居中的三种方法
- 设置margin和padding为0可去掉DIV与DIV的空白设置div背景透明的方法示例CSS实现div不设高度完全居中div自适应高度自动填充剩余高度详解DIV+CSS的命名规矩才能有利于SEO优化的实现方法DIV或者DIV里面的图片水平与垂直居中的方法详解如何用div实现自制滚动条div对齐与网页布局详解DIV+CSS实现电台列表设计的示例代码div+css实现带箭头的面包屑导航栏不定宽高的文字在div中垂直居中实现方法
- CSS属性探秘系列(六):margin浅谈css margin重叠CSS 之margin知识点(必看)css布局之负margin妙用及其他实现CSS的margin属性在页面布局中的使用攻略细说CSS中margin属性的使用 深入解析CSS中margin属性的使用CSS中使用负margin值来调整居中位置解决margin 外边距合并问题
- CSS属性探秘系列(五):min-widthIE6不支持CSS中的min-width/height属性问题的解决方法
- CSS属性探秘系列(三):line-heightCSS line-height行高上下居中垂直居中样式属性CSS行高line-height的个人理解css属性行高line-height的用法详解css line-height属性的使用技巧css中height和line-height区别
- CSS属性探秘系列(一):word-break与word-wrapcss word-break word-wrap 前台显示自动换行css中强制换行word-break、word-wrap、white-space区别实例说明CSS word-wrap同word-break的区别 word-wrap与word-break 属性的概述及浏览器默认处理word-break:break-all和word-wrap:break-word区别总结
- css中position:fixed实现div在窗口上下左右居中不定宽高的文字在div中垂直居中实现方法关于div中img,span垂直居中的问题让Div实现水平或垂直居中的相关方法div中内容上下居中小结css中position:fixed实现div居中上下左右居中DIV+CSS中让布局、背景图片、文字内容居中的方法IE9下DIV本来应该居中的结果显示为居左DIV+CSS垂直居中一个浮动元素CSS实现DIV居中的三种方法
- 权重和层叠规则决定了CSS样式优先级CSS样式覆盖规则全面了解纯CSS3绘制各种不规则图形图标样式特效源码CSS教程:网页中多个样式表顺序问题css样式层叠规则详解