这是一款非常有特点的CSS3按钮,按钮的背景不是北京图片,也不是单纯的颜色,而是一组魔幻般的冒泡背景动画。当我们将鼠标滑过按钮时,按钮的冒泡背景动画就可以展示出来。可以说这款CSS3按钮的设计风格相当有创意,而且令人惊叹的是,这些动画都是用CSS3实现的,并没有使用JavaScript,非常强大。

魔幻般冒泡背景的CSS3按钮动画-LMLPHP

HTML代码:

XML/HTML Code复制内容到剪贴板
  1. <div id="buttonContainer">
  2. <a href="#" class="button big blue">Big Button</a>
  3. <a href="#" class="button big green">Big Button</a>
  4. <a href="#" class="button big orange">Big Button</a>
  5. <a href="#" class="button big gray">Big Button</a>
  6. <a href="#" class="button blue medium">Medium Button</a>
  7. <a href="#" class="button green medium">Medium Button</a>
  8. <a href="#" class="button orange medium">Medium Button</a>
  9. <a href="#" class="button gray medium">Medium Button</a>
  10. <a href="#" class="button small blue">Small Button</a>
  11. <a href="#" class="button small green">Small Button</a>
  12. <a href="#" class="button small blue rounded">Rounded</a>
  13. <a href="#" class="button small orange">Small Button</a>
  14. <a href="#" class="button small gray">Small Button</a>
  15. <a href="#" class="button small green rounded">Rounded</a>
  16. </div>

css3背景动画

CSS Code复制内容到剪贴板
  1. .button{
  2. font:15px Calibri, Arial, sans-serif;
  3. /* A semi-transparent text shadow */
  4. text-shadow:1px 1px 0 rgba(255,255,255,0.4);
  5. /* Overriding the default underline styling of the links */
  6. text-decoration:none !important;
  7. whitewhite-space:nowrap;
  8. display:inline-block;
  9. vertical-align:baselinebaseline;
  10. position:relative;
  11. cursor:pointer;
  12. padding:10px 20px;
  13. background-repeat:no-repeat;
  14. /* The following two rules are fallbacks, in case
  15. the browser does not support multiple backgrounds. */
  16. background-position:bottombottom left;
  17. background-image:url('button_bg.png');
  18. /* Multiple backgrounds version. The background images
  19. are defined individually in color classes */
  20. background-position:bottombottom left, top rightright, 0 0, 0 0;
  21. background-clip:border-box;
  22. /* Applying a default border raidus of 8px */
  23. -moz-border-radius:8px;
  24. -webkit-border-radius:8px;
  25. border-radius:8px;
  26. /* A 1px highlight inside of the button */
  27. -moz-box-shadow:0 0 1px #fff inset;
  28. -webkit-box-shadow:0 0 1px #fff inset;
  29. box-shadow:0 0 1px #fff inset;
  30. /* Animating the background positions with CSS3 */
  31. /* Currently works only in Safari/Chrome */
  32. -webkit-transition:background-position 1s;
  33. -moz-transition:background-position 1s;
  34. transition:background-position 1s;
  35. }
  36. .button:hover{
  37. /* The first rule is a fallback, in case the browser
  38. does not support multiple backgrounds
  39. */
  40. background-position:top left;
  41. background-position:top left, bottombottom rightright, 0 0, 0 0;
  42. }
  43. .button:active{
  44. /* Moving the button 1px to the bottom when clicked */
  45. bottombottom:-1px;
  46. }
  47. /* The three buttons sizes */
  48. .button.big  { font-size:30px;}
  49. .button.medium { font-size:18px;}
  50. .button.small { font-size:13px;}
  51. /* A more rounded button */
  52. .button.rounded{
  53. -moz-border-radius:4em;
  54. -webkit-border-radius:4em;
  55. border-radius:4em;
  56. }
  57. /* Defining four button colors */
  58. /* BlueButton */
  59. .blue.button{
  60. color:#0f4b6d !important;
  61. border:1px solid #84acc3 !important;
  62. /* A fallback background color */
  63. background-color: #48b5f2;
  64. /* Specifying a version with gradients according to */
  65. background-image: url('button_bg.png'), url('button_bg.png'),
  66. -moz-radial-gradient( center bottombottom, circle,
  67. rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px),
  68. -moz-linear-gradient(#4fbbf7, #3faeeb);
  69. background-image: url('button_bg.png'), url('button_bg.png'),
  70. -webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100,
  71. from(rgba(89,208,244,1)), to(rgba(89,208,244,0))),
  72. -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb));
  73. }
  74. .blue.button:hover{
  75. background-color:#63c7fe;
  76. background-image: url('button_bg.png'), url('button_bg.png'),
  77. -moz-radial-gradient( center bottombottom, circle,
  78. rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px),
  79. -moz-linear-gradient(#63c7fe, #58bef7);
  80. background-image: url('button_bg.png'), url('button_bg.png'),
  81. -webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100,
  82. from(rgba(109,217,250,1)), to(rgba(109,217,250,0))),
  83. -webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7));
  84. }
  85. /* Green Button */
  86. .green.button{
  87. color:#345903 !important;
  88. border:1px solid #96a37b !important;
  89. background-color: #79be1e;
  90. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(162,211,30,1) 0,rgba(162,211,30,0) 100px),-moz-linear-gradient(#82cc27, #74b317);
  91. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(162,211,30,1)), to(rgba(162,211,30,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#82cc27), to(#74b317));
  92. }
  93. .green.button:hover{
  94. background-color:#89d228;
  95. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(183,229,45,1) 0,rgba(183,229,45,0) 100px),-moz-linear-gradient(#90de31, #7fc01e);
  96. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(183,229,45,1)), to(rgba(183,229,45,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#90de31), to(#7fc01e));
  97. }
  98. /* Orange Button */
  99. .orange.button{
  100. color:#693e0a !important;
  101. border:1px solid #bea280 !important;
  102. background-color: #e38d27;
  103. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(232,189,45,1) 0,rgba(232,189,45,0) 100px),-moz-linear-gradient(#f1982f, #d4821f);
  104. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(232,189,45,1)), to(rgba(232,189,45,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#f1982f), to(#d4821f));
  105. }
  106. .orange.button:hover{
  107. background-color:#ec9732;
  108. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(241,192,52,1) 0,rgba(241,192,52,0) 100px),-moz-linear-gradient(#f9a746, #e18f2b);
  109. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(241,192,52,1)), to(rgba(241,192,52,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9a746), to(#e18f2b));
  110. }
  111. .gray.button{
  112. color:#525252 !important;
  113. border:1px solid #a5a5a5 !important;
  114. background-color: #a9adb1;
  115. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(197,199,202,1) 0,rgba(197,199,202,0) 100px),-moz-linear-gradient(#c5c7ca, #92989c);
  116. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(197,199,202,1)), to(rgba(197,199,202,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#c5c7ca), to(#92989c));
  117. }
  118. .gray.button:hover{
  119. background-color:#b6bbc0;
  120. background-image:url('button_bg.png'), url('button_bg.png'), -moz-radial-gradient(center bottombottom, circle, rgba(202,205,208,1) 0,rgba(202,205,208,0) 100px),-moz-linear-gradient(#d1d3d6, #9fa5a9);
  121. background-image:url('button_bg.png'), url('button_bg.png'), -webkit-gradient(radial, 50% 100%, 0, 50% 100%, 100, from(rgba(202,205,208,1)), to(rgba(202,205,208,0))),-webkit-gradient(linear, 0% 0%, 0% 100%, from(#d1d3d6), to(#9fa5a9));
  122. }
04-03 13:56
查看更多