今天来分享很不错的css3按钮动画,这款css3按钮一共有5种动画方式,每一种都是鼠标滑过动画形式,虽然这些动画按钮不是十分华丽,但是小编觉得不像其他按钮那样很难扩展,我们可以修改css代码随意改变自己喜欢的颜色样式。6 ]- O* u0 }7 j# [* v% N9 a
2 A4 U7 l! h3 ~* l让我们一起来看看实现这5中样式动画按钮的html代码和css代码吧。以第一个按钮为例,其他按钮的代码大家可以下载源代码来研究,并不是很难。! X" ]$ [1 O0 J7 m4 ~/ |
html代码:
# K" p& s, x! A+ V5 T/ fxml/html code复制内容到剪贴板
+ S1 ^) r' P( g a4 L$ c! s<div class=button01>
6 k- ~- J3 o0 u2 A4 g<a href=#>download</a> , c3 [# R. F5 K, Z
<p class=top>click to begin</p> ! n4 s# r( f2 }" Q
<p class=bottom>1.2mb .zip</p> 0 ] `' I7 y; G$ M
</div>
5 F$ X3 [1 D# c+ { ?css代码:
( I% x8 {# a! V! G' W$ fcss code复制内容到剪贴板
3 N6 }' x: |, O/ G! x# k# Q.button01 {
. L7 |# v8 x- ]# B3 w( Pwidth: 200px;
. I/ b5 T, U) m- A2 y) imargin: 50px auto 20px auto;
; `0 \5 s y) T4 \; Y}
9 N' `$ u- d. [7 S- K
6 w: Y6 Z! E w. f0 B.button01 a {
- E% a3 m: J. H Odisplay: block;
5 Z6 b7 `5 M( l- O* ?0 d, e, sheight: 50px;
2 Z7 ]4 R" ?' ?6 P. \# ]width: 200px; " _: ^ \% W U
! t1 G( A$ e- e4 n; A
/*type*/ * f' e. I& a$ b1 D; s# j
color: white;
& o2 |# h& Y+ Ufont: 17px/50px helvetica, verdana, sans-serif;
! S# ?- H9 F( D7 J8 a1 k \: etext-decoration: none;
0 [6 [3 b4 i1 p T8 C8 z) m( vtext-align: center;
/ t) M0 T# w# I M$ Ltext-transform: uppercase;
' u; Q9 f9 |1 F7 e
* n3 e3 n; e2 {( s8 j7 @" t, T% Y8 V/*gradient*/
/ K7 P$ h, r6 Y2 m% ^+ dbackground: #00b7ea; /* old browsers */ 2 i4 O4 A& T" h3 s
background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* ff3.6+ */ $ F- P, @7 N6 V' a- O
background: -webkit-gradient(linear, left top, left bottombottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */ 0 g( h# K) V0 F& u6 S
background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* chrome10+,safari5.1+ */
u E/ @% w$ k$ Kbackground: -o-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* opera 11.10+ */ . u1 ?" b5 s, a- n- B
background: -ms-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* ie10+ */ 5 P9 E* `9 b" u! f. @: I/ l5 o
background: linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* w3c */
9 Q/ X c: M5 _filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */
3 e D# @0 r( Z} 7 R. K/ q) U& `2 \
) L& A. c6 e$ e# W
.button01 a, p { 6 @" S: H! U: W( w: w; O/ ]6 r
-webkit-border-radius: 10px; ; ~3 X0 x2 o" L( R! Z6 ^: [: E
-moz-border-radius: 10px; ) h5 Z: l8 x/ \5 t1 J+ n
border-radius: 10px; 6 c4 _/ k+ ^: G3 Z/ w/ Y& b
; u% _7 F }0 |/ S% b: ]9 ?-webkit-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
8 J; r1 x! M6 }& k-moz-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
S) D3 k: V& P) l5 R x$ I( _box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
4 x6 i8 |2 Y* t, I8 K}
: }# F1 f& Y! o3 `3 @: V* Z6 e4 O& o9 R. j& k
p { 7 k5 h3 l! k# P4 H! b P
background: #222; ( q( g: B* R0 R2 o( A, v5 y
display: block;
. k: |* {& {1 p2 q4 kheight: 40px; $ S: C, E5 b( R6 i3 H. s
width: 180px; & b- R8 b# C: W7 B( x
margin: -50px 0 0 10px; 5 D% d% q; Q& U: y
( h6 n1 I& z8 g( Q3 m; x! M
/*type*/
& u8 ?3 ^! ^ \" |8 Ytext-align: center;
$ [9 D- L& E5 L& H( e2 X6 ]font: 12px/45px helvetica, verdana, sans-serif; 1 a0 e7 {; X W! u F
color: #fff; 5 S* n6 i, F/ _# C" r% v5 W" ~
% q2 X# g0 d2 T
/*position*/ + g; A3 Z" C: N
position: absolute;
) S6 S8 `# M6 a# a" {) e& X, tz-index: -1; - f# P+ K' B6 S( D
( X/ C% S# b I* _
/*transition*/ / ~8 p9 H6 w9 a A6 S( i" ~
-webkit-transition: margin 0.5s ease; 5 @. i) U2 r/ M4 [/ ^
-moz-transition: margin 0.5s ease; - Z4 A2 E. b/ r( J# C
-o-transition: margin 0.5s ease; - K. R+ d0 j9 E. y( B0 g# t6 _
-ms-transition: margin 0.5s ease; : D" o0 D) j* t% J) x9 r( s2 {+ O4 p
transition: margin 0.5s ease; , e8 T2 N' q) c. L' y
} ) a6 V x" l% r8 d8 u
. O/ a; J. @, d/ R, K. W
/*hover*/
+ y, [, L* a+ w! I3 c4 u% l. Q.button01:hover .bottombottom { $ z; z3 U& S$ y/ O G' _% Y
margin: -10px 0 0 10px; # M+ G* m% }" J& f6 h# y9 `
}
8 Z' q9 r. q7 X5 g% u, t+ Y+ m' a, M
5 _. I& l% D& r; z7 q.button01:hover .top { ' I, L4 K+ H4 ^/ n2 D
margin: -80px 0 0 10px; * c- C, \( l% V. e7 s3 ^1 l( E% M
line-height: 35px;
) u5 Z- C9 c& f: h: K% W' s/ t}
8 b! w. ^; b/ K; d$ @: y- S$ m3 ~! e2 m n. J. x& S7 s- C% `2 Q
/*active*/
7 T5 j I# n+ U.button01 a:active {
; V, f* @3 r' N* p0 ?background: #00b7ea; /* old browsers */ / \% ]1 [5 v9 k& g3 G6 V
background: -moz-linear-gradient(top, #00b7ea 36%, #009ec3 100%); /* ff3.6+ */
7 ~! h3 j% A- k) J/ T( \0 Fbackground: -webkit-gradient(linear, left top, left bottombottom, color-stop(36%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */ ! }7 l: s, S# H1 T. M
background: -webkit-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* chrome10+,safari5.1+ */
* Z6 b; r: W5 B" d# obackground: -o-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* opera 11.10+ */
) \- l% f, q8 u# g% e$ f+ ubackground: -ms-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* ie10+ */ 8 R" E2 I, ~5 V5 S
background: linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* w3c */
8 v. h! i8 i1 g; O) c3 f- H6 ofilter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */ 5 A& C0 q7 t, W2 Z; A& Q
8 u; `5 Z4 `) C5 u9 e} 7 r% T2 ~& a+ l
5 r+ E& m9 q- |6 Y. t( k* O.button01:active .bottombottom { - {- q0 s" M+ T( U- O
margin: -20px 0 0 10px; / ^! X* Z1 d- Q
}
6 Z5 G" l4 e1 t% h" D6 R+ R! q6 T" t" ~. _" @
.button01:active .top { , T0 |$ L! T( K) V* r
margin: -70px 0 0 10px;
, w9 S% U _0 K6 y}
* y3 ~! a# w* ^3 j- m; E; }2 F$ F
5 _4 t) G. X$ l0 N6 \
更多网页制作信息请查看: 网页制作 |
|