CSS3 Gradient Buttons


/ Published in: CSS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* CSS3 Gradient Buttons http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/
  2.  
  3. /* button
  4. ---------------------------------------------- */
  5. .button {
  6. display: inline-block;
  7. zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
  8. *display: inline;
  9. vertical-align: baseline;
  10. margin: 0 2px;
  11. outline: none;
  12. cursor: pointer;
  13. text-align: center;
  14. text-decoration: none;
  15. font: 14px/100% Arial, Helvetica, sans-serif;
  16. padding: .5em 2em .55em;
  17. text-shadow: 0 1px 1px rgba(0,0,0,.3);
  18. -webkit-border-radius: .5em;
  19. -moz-border-radius: .5em;
  20. border-radius: .5em;
  21. -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
  22. -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
  23. box-shadow: 0 1px 2px rgba(0,0,0,.2);
  24. }
  25. .button:hover {
  26. text-decoration: none;
  27. }
  28. .button:active {
  29. position: relative;
  30. top: 1px;
  31. }
  32.  
  33. .bigrounded {
  34. -webkit-border-radius: 2em;
  35. -moz-border-radius: 2em;
  36. border-radius: 2em;
  37. }
  38. .medium {
  39. font-size: 12px;
  40. padding: .4em 1.5em .42em;
  41. }
  42. .small {
  43. font-size: 11px;
  44. padding: .2em 1em .275em;
  45. }
  46.  
  47. /* color styles
  48. ---------------------------------------------- */
  49.  
  50. /* black */
  51. .black {
  52. color: #d7d7d7;
  53. border: solid 1px #333;
  54. background: #333;
  55. background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#000));
  56. background: -moz-linear-gradient(top, #666, #000);
  57. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#666666', endColorstr='#000000');
  58. }
  59. .black:hover {
  60. background: #000;
  61. background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#000));
  62. background: -moz-linear-gradient(top, #444, #000);
  63. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#000000');
  64. }
  65. .black:active {
  66. color: #666;
  67. background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#444));
  68. background: -moz-linear-gradient(top, #000, #444);
  69. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#666666');
  70. }
  71.  
  72. /* gray */
  73. .gray {
  74. color: #e9e9e9;
  75. border: solid 1px #555;
  76. background: #6e6e6e;
  77. background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757));
  78. background: -moz-linear-gradient(top, #888, #575757);
  79. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757');
  80. }
  81. .gray:hover {
  82. background: #616161;
  83. background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b));
  84. background: -moz-linear-gradient(top, #757575, #4b4b4b);
  85. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b');
  86. }
  87. .gray:active {
  88. color: #afafaf;
  89. background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888));
  90. background: -moz-linear-gradient(top, #575757, #888);
  91. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888');
  92. }
  93.  
  94. /* white */
  95. .white {
  96. color: #606060;
  97. border: solid 1px #b7b7b7;
  98. background: #fff;
  99. background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
  100. background: -moz-linear-gradient(top, #fff, #ededed);
  101. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
  102. }
  103. .white:hover {
  104. background: #ededed;
  105. background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc));
  106. background: -moz-linear-gradient(top, #fff, #dcdcdc);
  107. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc');
  108. }
  109. .white:active {
  110. color: #999;
  111. background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff));
  112. background: -moz-linear-gradient(top, #ededed, #fff);
  113. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff');
  114. }
  115.  
  116. /* orange */
  117. .orange {
  118. color: #fef4e9;
  119. border: solid 1px #da7c0c;
  120. background: #f78d1d;
  121. background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
  122. background: -moz-linear-gradient(top, #faa51a, #f47a20);
  123. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
  124. }
  125. .orange:hover {
  126. background: #f47c20;
  127. background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
  128. background: -moz-linear-gradient(top, #f88e11, #f06015);
  129. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
  130. }
  131. .orange:active {
  132. color: #fcd3a5;
  133. background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
  134. background: -moz-linear-gradient(top, #f47a20, #faa51a);
  135. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
  136. }
  137.  
  138. /* red */
  139. .red {
  140. color: #faddde;
  141. border: solid 1px #980c10;
  142. background: #d81b21;
  143. background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
  144. background: -moz-linear-gradient(top, #ed1c24, #aa1317);
  145. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
  146. }
  147. .red:hover {
  148. background: #b61318;
  149. background: -webkit-gradient(linear, left top, left bottom, from(#c9151b), to(#a11115));
  150. background: -moz-linear-gradient(top, #c9151b, #a11115);
  151. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#c9151b', endColorstr='#a11115');
  152. }
  153. .red:active {
  154. color: #de898c;
  155. background: -webkit-gradient(linear, left top, left bottom, from(#aa1317), to(#ed1c24));
  156. background: -moz-linear-gradient(top, #aa1317, #ed1c24);
  157. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#aa1317', endColorstr='#ed1c24');
  158. }
  159.  
  160. /* blue */
  161. .blue {
  162. color: #d9eef7;
  163. border: solid 1px #0076a3;
  164. background: #0095cd;
  165. background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
  166. background: -moz-linear-gradient(top, #00adee, #0078a5);
  167. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
  168. }
  169. .blue:hover {
  170. background: #007ead;
  171. background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
  172. background: -moz-linear-gradient(top, #0095cc, #00678e);
  173. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');
  174. }
  175. .blue:active {
  176. color: #80bed6;
  177. background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));
  178. background: -moz-linear-gradient(top, #0078a5, #00adee);
  179. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');
  180. }
  181.  
  182. /* rosy */
  183. .rosy {
  184. color: #fae7e9;
  185. border: solid 1px #b73948;
  186. background: #da5867;
  187. background: -webkit-gradient(linear, left top, left bottom, from(#f16c7c), to(#bf404f));
  188. background: -moz-linear-gradient(top, #f16c7c, #bf404f);
  189. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f16c7c', endColorstr='#bf404f');
  190. }
  191. .rosy:hover {
  192. background: #ba4b58;
  193. background: -webkit-gradient(linear, left top, left bottom, from(#cf5d6a), to(#a53845));
  194. background: -moz-linear-gradient(top, #cf5d6a, #a53845);
  195. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cf5d6a', endColorstr='#a53845');
  196. }
  197. .rosy:active {
  198. color: #dca4ab;
  199. background: -webkit-gradient(linear, left top, left bottom, from(#bf404f), to(#f16c7c));
  200. background: -moz-linear-gradient(top, #bf404f, #f16c7c);
  201. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf404f', endColorstr='#f16c7c');
  202. }
  203.  
  204. /* green */
  205. .green {
  206. color: #e8f0de;
  207. border: solid 1px #538312;
  208. background: #64991e;
  209. background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
  210. background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
  211. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
  212. }
  213. .green:hover {
  214. background: #538018;
  215. background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
  216. background: -moz-linear-gradient(top, #6b9d28, #436b0c);
  217. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
  218. }
  219. .green:active {
  220. color: #a9c08c;
  221. background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
  222. background: -moz-linear-gradient(top, #4e7d0e, #7db72f);
  223. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
  224. }
  225.  
  226. /* pink */
  227. .pink {
  228. color: #feeef5;
  229. border: solid 1px #d2729e;
  230. background: #f895c2;
  231. background: -webkit-gradient(linear, left top, left bottom, from(#feb1d3), to(#f171ab));
  232. background: -moz-linear-gradient(top, #feb1d3, #f171ab);
  233. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#feb1d3', endColorstr='#f171ab');
  234. }
  235. .pink:hover {
  236. background: #d57ea5;
  237. background: -webkit-gradient(linear, left top, left bottom, from(#f4aacb), to(#e86ca4));
  238. background: -moz-linear-gradient(top, #f4aacb, #e86ca4);
  239. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4aacb', endColorstr='#e86ca4');
  240. }
  241. .pink:active {
  242. color: #f3c3d9;
  243. background: -webkit-gradient(linear, left top, left bottom, from(#f171ab), to(#feb1d3));
  244. background: -moz-linear-gradient(top, #f171ab, #feb1d3);
  245. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f171ab', endColorstr='#feb1d3');
  246. }

URL: http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.