今天来分享很不错的css3按钮动画,这款css3按钮一共有5种动画方式,每一种都是鼠标滑过动画形式,虽然这些动画按钮不是十分华丽,但是小编觉得不像其他按钮那样很难扩展,我们可以修改css代码随意改变自己喜欢的颜色样式。
% T. e* T# W, n6 @+ L5 o" {, B. U
/ o4 j7 [' ?( M4 ?% k. K让我们一起来看看实现这5中样式动画按钮的html代码和css代码吧。以第一个按钮为例,其他按钮的代码大家可以下载源代码来研究,并不是很难。
( `6 z' K" Z, O: Ahtml代码:8 S) F: M; o) g7 I- }$ v6 ?7 _/ N6 ^
xml/html code复制内容到剪贴板" {; C$ G; S5 W% B/ e! l, V2 X
<div class=button01>
7 ?* z9 H. @. V0 V' o% \; {<a href=#>download</a>
0 a- u4 y1 c& A2 i6 L5 Q- }<p class=top>click to begin</p> $ H2 U2 N7 n% h' N
<p class=bottom>1.2mb .zip</p> # p* N5 v/ u- Q
</div> 8 X2 \/ R( H8 i& w2 A8 u4 h5 G
css代码:, ^0 N) [( r- A' Y7 Y" w* ^
css code复制内容到剪贴板
/ h7 R, O! X% w8 h8 a' U.button01 { / y9 u0 m ~6 w+ B2 y" s2 k
width: 200px; * ]7 Z r1 N/ \4 h
margin: 50px auto 20px auto; ! b) r6 X1 X' _; w
}
( R7 [3 _& w9 L. `
6 m+ E$ S" p! T' o# t.button01 a {
. m2 P6 h1 B/ q& l8 Xdisplay: block;
$ Q( A( [1 O9 Jheight: 50px;
7 y) S! a7 m! Lwidth: 200px; : e j- h+ h9 J6 K! e
, y' L! z5 ]; l* s
/*type*/
' F3 B, }: N2 @3 ?color: white; 2 R" D5 {) h9 c$ J, _
font: 17px/50px helvetica, verdana, sans-serif;
2 |" W! W' V) Q# G( d. V: o: \text-decoration: none; " x5 F: L) j( \/ P
text-align: center;
8 L/ J- M Z0 ^" i3 O! otext-transform: uppercase;
! E, c. @7 I7 d7 |+ y' _7 `/ G( G' S1 A7 d# D4 Z% f e
/*gradient*/
0 c; g- y% g, g: Obackground: #00b7ea; /* old browsers */ * m) b2 @0 J3 H6 }4 q& E
background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* ff3.6+ */ 3 p. I) z+ C1 y3 O4 O$ F
background: -webkit-gradient(linear, left top, left bottombottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */
! H2 e& P. m& e- B: Y6 Xbackground: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* chrome10+,safari5.1+ */ 4 N$ g) M+ {+ P* ^+ ~$ m1 n, q
background: -o-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* opera 11.10+ */ # O3 H' c9 {# Q% Y. w! N# K
background: -ms-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* ie10+ */
! Z# s( U6 a. pbackground: linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* w3c */ , S1 ~7 F$ O/ \! |
filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */ . Z8 v6 J+ k2 d) x4 a$ |2 J, C9 B1 s* g
}
; W3 ~# C6 m) {" a9 O- L$ A x# L
: L6 K, F! o) t.button01 a, p { 8 L1 _( c# y4 j
-webkit-border-radius: 10px;
5 u" O- _4 z7 C* I-moz-border-radius: 10px; + n) b l* c! K, K5 D
border-radius: 10px;
- _$ @8 ] _( Z ~2 g
1 Z7 P2 o- d5 R-webkit-box-shadow: 2px 2px 8px rgba(0,0,0,0.2); ; z% `; B3 f4 C0 H9 D; i: Q% \
-moz-box-shadow: 2px 2px 8px rgba(0,0,0,0.2); 1 X! ?! E' ]6 r' E: r. P, T) w- l
box-shadow: 2px 2px 8px rgba(0,0,0,0.2); ' _ @3 `( L& o0 J5 i0 P
} # g( x p4 U- a# Q& |
( m: B, |! Q; v/ _) Tp { 3 k0 h/ ], Y% s$ l; K; n0 ]
background: #222;
" E8 l. N: E# d) Adisplay: block;
; Z0 ~6 Z+ t2 ]height: 40px;
8 t" H# q* ^+ f4 T: Kwidth: 180px; ! ]) B* H% K. i* {6 A. K2 p! V
margin: -50px 0 0 10px;
& ]; m4 W5 g9 y# O1 m
, U# L5 G a/ {7 u {: `9 G/*type*/
# i D5 T% M2 g; i" l3 j, ctext-align: center;
3 {( n# x7 y: J2 s3 K2 afont: 12px/45px helvetica, verdana, sans-serif; * q& N! d, D- Z: o! a
color: #fff;
. l( Z0 R9 F% e7 n$ z
2 c" g* b' g! E7 p; l/*position*/ 1 q3 _; b5 @1 L, ~' m& s
position: absolute; 1 h6 U7 @) |( t5 d3 Z
z-index: -1; ) v- [2 D9 {- q2 _/ t; h
2 A* _7 E& x/ l
/*transition*/ & b! C) h; w! x8 g/ r) D8 ^
-webkit-transition: margin 0.5s ease;
3 O7 }# w* f- _-moz-transition: margin 0.5s ease;
) C! c: Q! L. |0 W9 L-o-transition: margin 0.5s ease; % J$ A3 @6 |5 `( H! u! b' U
-ms-transition: margin 0.5s ease; ) i. Z. x0 H: M- {
transition: margin 0.5s ease; ~- i4 a' G g0 Y6 k! \+ E# Q' w
}
) X9 H0 _5 V7 \4 J$ K5 w5 b" U8 W% n: s( J! I+ i
/*hover*/
2 ]9 |6 ^8 s N, {1 V! i.button01:hover .bottombottom {
: l8 q6 q( d- Umargin: -10px 0 0 10px;
_# p4 d! z, U1 d}
1 U7 c, ~' Q7 _3 R! g/ V6 r) t [% r* y; x+ q
.button01:hover .top {
- z. P2 B% [8 l) C" [$ x3 U! ymargin: -80px 0 0 10px;
, t' y0 K# u0 |7 {line-height: 35px;
, p! _6 B$ k' E. m7 o: D}
1 h# O$ y9 Q! i% f
} M& i, n% C9 C0 m! _/*active*/
5 e t4 M9 ?9 M) K: h# t* z.button01 a:active {
2 |% t; f2 F0 p9 `3 q& kbackground: #00b7ea; /* old browsers */ : E0 X# r- s' p7 D
background: -moz-linear-gradient(top, #00b7ea 36%, #009ec3 100%); /* ff3.6+ */ 2 \. u5 p/ ~2 C& l) j& \
background: -webkit-gradient(linear, left top, left bottombottom, color-stop(36%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */
7 p4 W, T, }& |+ C: ^- ybackground: -webkit-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* chrome10+,safari5.1+ */ + Z4 D; G: Z4 j6 v
background: -o-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* opera 11.10+ */ n* A; X1 M# o/ | Z8 G& `
background: -ms-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* ie10+ */
0 Y4 `* s6 j! B7 i& \background: linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* w3c */ - j R( m/ Y( d# G- ?6 C
filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */
: S3 `9 ]3 X3 N/ Z: a
7 C1 D# Y, W* W1 H} : n$ t; _/ S' ]3 p2 B: p. K. M
; D0 v4 o! m3 f: o
.button01:active .bottombottom { 4 d$ S. ?" G1 |5 r5 V6 @/ ]
margin: -20px 0 0 10px; : C% q/ l: w+ M- X* [! _* w2 Y3 C
}
2 z2 K& f* Y: Q% k
, l; n& A3 W5 [6 J) c.button01:active .top {
" S$ j5 \2 V# Z5 x* e( I; O. Rmargin: -70px 0 0 10px;
6 W9 J7 w# C2 s+ `) ?. b}
, g5 J/ [9 ^7 b/ t; A7 v0 Q6 A/ F1 J
3 j; C$ ~9 ?; B& h
更多网页制作信息请查看: 网页制作 |
|