---
title: "css 3 按钮"
author: "endual"
date: "2013-03-28T15:10:27Z"
tags: []
categories: ["Web前端"]
slug: "css-3"
draft: false
lastmod: "2013-03-28T15:10:27Z"
id: 1838030
url: "https://endual.iteye.com/blog/1838030"
---

# CSS3 Gradient Buttons

* * *

 / Published in: [CSS](http://snipplr.com/all/language/CSS)

  

![](http://snipplr.com/img/icon_sav.png)

* * *

URL: [http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/](http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/)

 

[](/admin/blogs/)Expand | [Embed](http://snipplr.com/view/47951/) | [Plain Text](http://snipplr.com/view.php?codeview&id=47951)

001. /* CSS3 Gradient Buttons http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/
002. /* button
003. ---------------------------------------------- \*/
004. .button {
005. display: inline-block;
006. zoom: 1; /* zoom and \*display = ie7 hack for display:inline-block \*/
007. \*display: inline;
008. vertical-align: baseline;
009. margin: 0 2px;
010. outline: none;
011. cursor: pointer;
012. text-align: center;
013. text-decoration: none;
014. font: 14px/100% Arial, Helvetica, sans-serif;
015. padding: .5em 2em .55em;
016. text-shadow: 0 1px 1px rgba(0,0,0,.3);
017. -webkit-border-radius: .5em;
018. -moz-border-radius: .5em;
019. border-radius: .5em;
020. -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
021. -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
022. box-shadow: 0 1px 2px rgba(0,0,0,.2);
023. }
024. .button:hover {
025. text-decoration: none;
026. }
027. .button:active {
028. position: relative;
029. top: 1px;
030. }
031. .bigrounded {
032. -webkit-border-radius: 2em;
033. -moz-border-radius: 2em;
034. border-radius: 2em;
035. }
036. .medium {
037. font-size: 12px;
038. padding: .4em 1.5em .42em;
039. }
040. .small {
041. font-size: 11px;
042. padding: .2em 1em .275em;
043. }
044. /* color styles
045. ---------------------------------------------- \*/
046. /* black \*/
047. .black {
048. color: #d7d7d7;
049. border: solid 1px #333;
050. background: #333;
051. background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#000));
052. background: -moz-linear-gradient(top, #666, #000);
053. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#666666', endColorstr='#000000');
054. }
055. .black:hover {
056. background: #000;
057. background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#000));
058. background: -moz-linear-gradient(top, #444, #000);
059. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#000000');
060. }
061. .black:active {
062. color: #666;
063. background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#444));
064. background: -moz-linear-gradient(top, #000, #444);
065. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#666666');
066. }
067. /* gray \*/
068. .gray {
069. color: #e9e9e9;
070. border: solid 1px #555;
071. background: #6e6e6e;
072. background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757));
073. background: -moz-linear-gradient(top, #888, #575757);
074. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757');
075. }
076. .gray:hover {
077. background: #616161;
078. background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b));
079. background: -moz-linear-gradient(top, #757575, #4b4b4b);
080. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b');
081. }
082. .gray:active {
083. color: #afafaf;
084. background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888));
085. background: -moz-linear-gradient(top, #575757, #888);
086. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888');
087. }
088. /* white \*/
089. .white {
090. color: #606060;
091. border: solid 1px #b7b7b7;
092. background: #fff;
093. background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
094. background: -moz-linear-gradient(top, #fff, #ededed);
095. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
096. }
097. .white:hover {
098. background: #ededed;
099. background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc));
100. background: -moz-linear-gradient(top, #fff, #dcdcdc);
101. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc');
102. }
103. .white:active {
104. color: #999;
105. background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff));
106. background: -moz-linear-gradient(top, #ededed, #fff);
107. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff');
108. }
109. /* orange \*/
110. .orange {
111. color: #fef4e9;
112. border: solid 1px #da7c0c;
113. background: #f78d1d;
114. background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
115. background: -moz-linear-gradient(top, #faa51a, #f47a20);
116. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
117. }
118. .orange:hover {
119. background: #f47c20;
120. background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
121. background: -moz-linear-gradient(top, #f88e11, #f06015);
122. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
123. }
124. .orange:active {
125. color: #fcd3a5;
126. background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
127. background: -moz-linear-gradient(top, #f47a20, #faa51a);
128. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
129. }
130. /* red \*/
131. .red {
132. color: #faddde;
133. border: solid 1px #980c10;
134. background: #d81b21;
135. background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
136. background: -moz-linear-gradient(top, #ed1c24, #aa1317);
137. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
138. }
139. .red:hover {
140. background: #b61318;
141. background: -webkit-gradient(linear, left top, left bottom, from(#c9151b), to(#a11115));
142. background: -moz-linear-gradient(top, #c9151b, #a11115);
143. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#c9151b', endColorstr='#a11115');
144. }
145. .red:active {
146. color: #de898c;
147. background: -webkit-gradient(linear, left top, left bottom, from(#aa1317), to(#ed1c24));
148. background: -moz-linear-gradient(top, #aa1317, #ed1c24);
149. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#aa1317', endColorstr='#ed1c24');
150. }
151. /* blue \*/
152. .blue {
153. color: #d9eef7;
154. border: solid 1px #0076a3;
155. background: #0095cd;
156. background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
157. background: -moz-linear-gradient(top, #00adee, #0078a5);
158. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
159. }
160. .blue:hover {
161. background: #007ead;
162. background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
163. background: -moz-linear-gradient(top, #0095cc, #00678e);
164. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');
165. }
166. .blue:active {
167. color: #80bed6;
168. background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));
169. background: -moz-linear-gradient(top, #0078a5, #00adee);
170. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');
171. }
172. /* rosy \*/
173. .rosy {
174. color: #fae7e9;
175. border: solid 1px #b73948;
176. background: #da5867;
177. background: -webkit-gradient(linear, left top, left bottom, from(#f16c7c), to(#bf404f));
178. background: -moz-linear-gradient(top, #f16c7c, #bf404f);
179. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f16c7c', endColorstr='#bf404f');
180. }
181. .rosy:hover {
182. background: #ba4b58;
183. background: -webkit-gradient(linear, left top, left bottom, from(#cf5d6a), to(#a53845));
184. background: -moz-linear-gradient(top, #cf5d6a, #a53845);
185. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cf5d6a', endColorstr='#a53845');
186. }
187. .rosy:active {
188. color: #dca4ab;
189. background: -webkit-gradient(linear, left top, left bottom, from(#bf404f), to(#f16c7c));
190. background: -moz-linear-gradient(top, #bf404f, #f16c7c);
191. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf404f', endColorstr='#f16c7c');
192. }
193. /* green \*/
194. .green {
195. color: #e8f0de;
196. border: solid 1px #538312;
197. background: #64991e;
198. background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
199. background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
200. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
201. }
202. .green:hover {
203. background: #538018;
204. background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
205. background: -moz-linear-gradient(top, #6b9d28, #436b0c);
206. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
207. }
208. .green:active {
209. color: #a9c08c;
210. background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
211. background: -moz-linear-gradient(top, #4e7d0e, #7db72f);
212. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
213. }
214. /* pink \*/
215. .pink {
216. color: #feeef5;
217. border: solid 1px #d2729e;
218. background: #f895c2;
219. background: -webkit-gradient(linear, left top, left bottom, from(#feb1d3), to(#f171ab));
220. background: -moz-linear-gradient(top, #feb1d3, #f171ab);
221. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#feb1d3', endColorstr='#f171ab');
222. }
223. .pink:hover {
224. background: #d57ea5;
225. background: -webkit-gradient(linear, left top, left bottom, from(#f4aacb), to(#e86ca4));
226. background: -moz-linear-gradient(top, #f4aacb, #e86ca4);
227. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4aacb', endColorstr='#e86ca4');
228. }
229. .pink:active {
230. color: #f3c3d9;
231. background: -webkit-gradient(linear, left top, left bottom, from(#f171ab), to(#feb1d3));
232. background: -moz-linear-gradient(top, #f171ab, #feb1d3);
233. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f171ab', endColorstr='#feb1d3');
234. }

[Report this snippet](http://snipplr.com/view/47951/ "Use this to report spam") [Tweet](http://twitter.com/share)&lt;iframe style="line-height: 1.22em; border-style: none; overflow: hidden; width: 100px; height: 21px;" src="http://www.facebook.com/plugins/like.php?href&amp;send=false&amp;layout=button\_count&amp;width=100&amp;show\_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=199515416764139" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;

## Related Snippets

* * *

01. [Create gradient buttons using css](http://snipplr.com/view/18881/)
02. [CSS Gradient](http://snipplr.com/view/50241/)
03. [CSS3 Gradient Background](http://snipplr.com/view/26612/)
04. [Pure CSS3 Buttons](http://snipplr.com/view/57704/)
05. [Kickapps: use jQuery & CSS to hide MYRSS & MYLINKS buttons in member profile edit pages](http://snipplr.com/view/16459/)
06. [Crossbrowser CSS Gradient](http://snipplr.com/view/40299/)
07. [CSS Buttons - horizontal nav bar w/out images](http://snipplr.com/view/1789/)
08. [One pixel, pure CSS2 rounded buttons](http://snipplr.com/view/24615/)
09. [CSS - Adding a gradient – linear-gradient](http://snipplr.com/view/66661/)
10. [CSS3 Button with hover over, shadowing, and gradient](http://snipplr.com/view/57859/)