一款简洁的纯css3代码实现的动画导航
程序员文章站
2022-06-26 10:27:22
之前为大家介绍了好多导航菜单,今天给大家分享一款简洁的纯css3代码实现的动画导航。鼠标经过的时候以背景色以菱形渐变为长方形。具体效果如下文... 14-10-31...
之前为大家介绍了好多导航菜单,今天给大家分享一款简洁的纯css3代码实现的动画导航。鼠标经过的时候以背景色以菱形渐变为长方形。效果图如下:
实现的代码。
html代码:
复制代码
代码如下: <div align="center" style="background-color: #ee1d27; padding: 20px;">
<div class="contener_link">
<div class="link_txt">
menu one</div>
</div>
<div class="contener_link">
<div class="link_txt">
menu two</div>
</div>
<div class="contener_link">
<div class="link_txt">
menu three</div>
</div>
</div>
<div class="contener_link">
<div class="link_txt">
menu one</div>
</div>
<div class="contener_link">
<div class="link_txt">
menu two</div>
</div>
<div class="contener_link">
<div class="link_txt">
menu three</div>
</div>
</div>
css3代码:
复制代码
代码如下: .contener_link
{
text-align: center;
position: relative;
width: 170px;
height: 50px;
cursor: pointer;
display: inline-block;
}
.contener_link .link_txt
{
font-family:'roboto';
position: absolute;
width: 150px;
font-weight: 300;
text-decoration: none;
font-size:22px;
padding: 10px;
color: #ffffff;
}
.contener_link:hover
{
background-color: #f8b334;
-webkit-animation-duration:1s;
-webkit-animation-name: diaganim;
-moz-animation-duration:1s;
-moz-animation-name: diaganim;
-ms-animation-duration:1s;
-ms-animation-name: diaganim;
animation-duration:1s;
animation-name: diaganim;
}
@-webkit-keyframes diaganim
{
0% {-webkit-transform: skewx(-80deg);}
100% {-webkit-transform: skewx(0deg);}
}
@-moz-keyframes diaganim
{
0% {-moz-transform: skewx(-80deg);}
100% {-moz-transform: skewx(0deg);}
}
@-ms-keyframes diaganim
{
0% {-ms-transform: skewx(-80deg);}
100% {-ms-transform: skewx(0deg);}
}
@keyframes diaganim
{
0% {transform: skewx(-80deg);}
100% {transform: skewx(0deg);}
}
{
text-align: center;
position: relative;
width: 170px;
height: 50px;
cursor: pointer;
display: inline-block;
}
.contener_link .link_txt
{
font-family:'roboto';
position: absolute;
width: 150px;
font-weight: 300;
text-decoration: none;
font-size:22px;
padding: 10px;
color: #ffffff;
}
.contener_link:hover
{
background-color: #f8b334;
-webkit-animation-duration:1s;
-webkit-animation-name: diaganim;
-moz-animation-duration:1s;
-moz-animation-name: diaganim;
-ms-animation-duration:1s;
-ms-animation-name: diaganim;
animation-duration:1s;
animation-name: diaganim;
}
@-webkit-keyframes diaganim
{
0% {-webkit-transform: skewx(-80deg);}
100% {-webkit-transform: skewx(0deg);}
}
@-moz-keyframes diaganim
{
0% {-moz-transform: skewx(-80deg);}
100% {-moz-transform: skewx(0deg);}
}
@-ms-keyframes diaganim
{
0% {-ms-transform: skewx(-80deg);}
100% {-ms-transform: skewx(0deg);}
}
@keyframes diaganim
{
0% {transform: skewx(-80deg);}
100% {transform: skewx(0deg);}
}
上一篇: C++学习体会--构造函数初始化数据成员值的两条路
下一篇: jQuery中after的两种用法实例