五款漂亮的纯CSS3动画按钮的实例教程


  今天来分享很不错的CSS3按钮动画,这款CSS3按钮一共有5种动画方式,每一种都是鼠标滑过动画形式,虽然这些动画按钮不是十分华丽,但是小编觉得不像其他按钮那样很难扩展,我们可以修改CSS代码随意改变自己喜欢的颜色样式。

  让我们一起来看看实现这5中样式动画按钮的HTML代码和CSS代码吧。以第一个按钮为例,其他按钮的代码大家可以下载源代码来研究,并不是很难。

  HTML代码:

XML/HTML Code复制内容到剪贴板
  1. <div class="button01">  
  2.       <a href="#">Download</a>  
  3.       <p class="top">click to begin</p>  
  4.       <p class="bottom">1.2MB .zip</p>  
  5. </div>  

  CSS代码:

CSS Code复制内容到剪贴板
  1. .button01 {   
  2.   width200px;   
  3.   margin50px auto 20px auto;   
  4. }   
  5.   
  6. .button01 a {   
  7.   displayblock;   
  8.   height50px;   
  9.   width200px;   
  10.   
  11.   /*TYPE*/  
  12.   colorwhite;   
  13.   font17px/50px HelveticaVerdanasans-serif;   
  14.   text-decorationnone;   
  15.   text-aligncenter;   
  16.   text-transformuppercase;   
  17.   
  18.   /*GRADIENT*/     
  19.   background#00b7ea/* Old browsers */  
  20.   background: -moz-linear-gradient(top#00b7ea 0%, #009ec3 100%); /* FF3.6+ */  
  21.   background: -webkit-gradient(linear, left topleft bottombottomcolor-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */  
  22.   background: -webkit-linear-gradient(top#00b7ea 0%,#009ec3 100%); /* Chrome10+,Safari5.1+ */  
  23.   background: -o-linear-gradient(top#00b7ea 0%,#009ec3 100%); /* Opera 11.10+ */  
  24.   background: -ms-linear-gradient(top#00b7ea 0%,#009ec3 100%); /* IE10+ */  
  25.   background: linear-gradient(top#00b7ea 0%,#009ec3 100%); /* W3C */  
  26.   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */  
  27. }   
  28.   
  29. .button01 a, p {   
  30.     -webkit-border-radius: 10px;   
  31.      -moz-border-radius: 10px;   
  32.           border-radius: 10px;   
  33.   
  34.   -webkit-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);   
  35.      -moz-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);   
  36.           box-shadow: 2px 2px 8px rgba(0,0,0,0.2);   
  37. }   
  38.   
  39. p {   
  40.   background#222;   
  41.   displayblock;   
  42.   height40px;   
  43.   width180px;    
  44.   margin: -50px 0 0 10px;   
  45.   
  46.   /*TYPE*/  
  47.   text-aligncenter;   
  48.   font12px/45px HelveticaVerdanasans-serif;   
  49.   color#fff;   
  50.   
  51.   /*POSITION*/  
  52.   positionabsolute;   
  53.   z-index: -1;   
  54.   
  55.   /*TRANSITION*/     
  56.   -webkit-transition: margin 0.5s ease;   
  57.      -moz-transition: margin 0.5s ease;   
  58.        -o-transition: margin 0.5s ease;   
  59.       -ms-transition: margin 0.5s ease;   
  60.           transition: margin 0.5s ease;   
  61. }   
  62.   
  63. /*HOVER*/  
  64. .button01:hover .bottombottom {   
  65.   margin: -10px 0 0 10px;   
  66. }   
  67.   
  68. .button01:hover .top {   
  69.   margin: -80px 0 0 10px;   
  70.   line-height35px;   
  71. }   
  72.   
  73. /*ACTIVE*/  
  74. .button01 a:active {   
  75.       background#00b7ea/* Old browsers */  
  76.       background: -moz-linear-gradient(top,  #00b7ea 36%, #009ec3 100%); /* FF3.6+ */  
  77.       background: -webkit-gradient(linear, left topleft bottombottomcolor-stop(36%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */  
  78.       background: -webkit-linear-gradient(top,  #00b7ea 36%,#009ec3 100%); /* Chrome10+,Safari5.1+ */  
  79.       background: -o-linear-gradient(top,  #00b7ea 36%,#009ec3 100%); /* Opera 11.10+ */  
  80.       background: -ms-linear-gradient(top,  #00b7ea 36%,#009ec3 100%); /* IE10+ */  
  81.       background: linear-gradient(top,  #00b7ea 36%,#009ec3 100%); /* W3C */  
  82.       filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */  
  83.   
  84. }   
  85.   
  86. .button01:active .bottombottom {   
  87.   margin: -20px 0 0 10px;   
  88. }   
  89.   
  90. .button01:active .top {   
  91.   margin: -70px 0 0 10px;   
  92. }  

 相关推荐:

  纯css3实现的动画按钮的实例教程

  一款纯css3实现的颜色渐变按钮的代码教程

  一款纯css3实现的鼠标经过按钮特效教程

  利用css3实现的简单的鼠标悬停按钮

  纯CSS3发光分享按钮的实现教程


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3