今天来分享很不错的css3按钮动画,这款css3按钮一共有5种动画方式,每一种都是鼠标滑过动画形式,虽然这些动画按钮不是十分华丽,但是小编觉得不像其他按钮那样很难扩展,我们可以修改css代码随意改变自己喜欢的颜色样式。
4 P# p6 E0 Q2 k+ L6 W5 w
?8 |$ T6 K2 w0 Z让我们一起来看看实现这5中样式动画按钮的html代码和css代码吧。以第一个按钮为例,其他按钮的代码大家可以下载源代码来研究,并不是很难。, U |- l7 H1 F" B& [6 v
html代码:, r: v2 h- \" H4 |/ d/ d
xml/html code复制内容到剪贴板
- j! ]" M2 \$ H8 w% x+ C% F. g<div class=button01> % j* E2 x- z t: Z/ i/ n; n
<a href=#>download</a>
% s! b. o4 |! j<p class=top>click to begin</p>
/ U+ e0 m' X4 J* z& r/ F. F<p class=bottom>1.2mb .zip</p> 1 K* n4 d; g% _- N
</div>
# O- k% o! N# _css代码:
' A1 G/ b% M, ~5 _css code复制内容到剪贴板
% F* |6 [; c% U6 Q.button01 {
* M" s' D4 c9 [+ P6 ?0 wwidth: 200px;
0 w4 E2 f$ R: O5 nmargin: 50px auto 20px auto;
4 _8 P: O8 `" O1 y4 e* j1 j} ( r) S6 _& ~% F) R. y
1 R8 d8 d2 Z: `# p0 q! x* c
.button01 a { 3 _ L, [7 ^" \; O
display: block;
" U% M. A! m ~* }. X! Xheight: 50px;
2 l/ O1 v |' C* Iwidth: 200px; ) R5 c9 Z5 x7 s, a: [' r
5 \' |! g8 v: [
/*type*/
5 c. W+ L1 b N( n: p5 r( _color: white; O' _) F, |+ \: c6 N, @6 j
font: 17px/50px helvetica, verdana, sans-serif;
* o; |; Q% P$ m: Z$ Otext-decoration: none; . _+ Y9 s/ B. }' @4 Y5 P0 A
text-align: center;
! I( j, D8 l: |" Vtext-transform: uppercase; / C/ l; [2 |# N# |- O4 X$ [
( ]- i* V, J+ K4 o& Y
/*gradient*/ & q" g. o& \+ r* v9 n
background: #00b7ea; /* old browsers */ ! W( r8 f8 e$ h) n7 V
background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* ff3.6+ */ : U- s$ h' v/ U. Y9 b0 f
background: -webkit-gradient(linear, left top, left bottombottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */ ' X7 [: ?& `. V- A
background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* chrome10+,safari5.1+ */ % K: J1 ?- p% Z
background: -o-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* opera 11.10+ */
# @7 |1 N3 \# t4 pbackground: -ms-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* ie10+ */
. A7 v: R9 D, n9 V' A8 i7 L. \9 Ebackground: linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* w3c */ ! E% U8 X1 X' ?6 D; B% I
filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */ ; U$ { R% V, d7 T1 g) |
} + K1 J0 q: J+ I! g: x
- y4 r( P" v1 l: G6 Z.button01 a, p { ( A* j4 B% s& E0 |! `
-webkit-border-radius: 10px;
* V7 q# n+ d' j; u-moz-border-radius: 10px;
7 R6 @1 L8 a. g9 I' Pborder-radius: 10px;
2 [# U" Z: s' B4 F+ U
) L" k0 N, o' I-webkit-box-shadow: 2px 2px 8px rgba(0,0,0,0.2); 1 _' M, B7 [/ ~
-moz-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
$ B- l2 s" U1 L( U9 l5 \3 Rbox-shadow: 2px 2px 8px rgba(0,0,0,0.2); * Q7 ^ d8 w. ?& z7 f( U6 ?. x% b* q
} " m# e3 L2 }' T& }
L5 Q8 `# n8 V* P
p {
2 F0 f# o8 X" i! h& `' V8 lbackground: #222;
6 W, @0 \: O; @5 G% }display: block;
# }9 Q e ]9 g9 s" Zheight: 40px;
6 c( a! o9 Q- p! O' j/ X; f/ m7 {width: 180px; ) Y: R4 k# t; n& J6 a8 o4 O% P1 W, j
margin: -50px 0 0 10px;
( q/ V( e2 n8 n7 s; E% c1 }/ P) l2 {4 |& H
/*type*/ ( h: q& Z7 ?- p
text-align: center;
7 c+ _# s% w! W) n$ M. l o1 tfont: 12px/45px helvetica, verdana, sans-serif; 1 Z" G2 I/ O# U7 Q' L
color: #fff; - m; M+ O0 h% ~
( F# i6 Z8 {6 m! R7 b/*position*/ 3 a8 S/ s2 ~( s, z: e
position: absolute; 1 R+ t4 e( b; x9 C: r2 d
z-index: -1; $ ~/ h2 X: L: R$ Z" C
: H1 c4 y# H c% E" q
/*transition*/ + K2 ^! o' s9 V' n/ K. M( K, y$ i
-webkit-transition: margin 0.5s ease; 5 V/ }: T1 i! L0 l& {; ]
-moz-transition: margin 0.5s ease;
* x* @% n6 M8 g7 U' u8 x-o-transition: margin 0.5s ease; ' |1 b" |& U6 n7 _3 J* [5 u
-ms-transition: margin 0.5s ease; 1 X/ P, |" X) P; F/ B
transition: margin 0.5s ease; 2 H8 `: O. P' E# g" o+ s
}
' L- F+ H- @; m; g3 W8 K7 h0 L2 j5 {; E- Q) [
/*hover*/
1 @' ]3 A( X4 K# l6 [5 x.button01:hover .bottombottom {
3 p, @2 L3 c; b8 Z, @0 Amargin: -10px 0 0 10px; ' @: [+ |! D+ x
}
$ T7 g) J% r I5 S. M& r) b$ {7 r
* f: q1 S3 b# `! n5 F1 P1 M.button01:hover .top {
! n! i) l0 d- G4 {# mmargin: -80px 0 0 10px; $ a+ q2 n9 O9 h& S. u) X
line-height: 35px; $ Q& w0 X' x6 p; _ k& n( a
}
' R8 T$ t3 S8 K, J) \ H7 a$ e. @) K3 X; N* G5 p& E. k6 s
/*active*/
! E4 b2 ]/ g8 h9 Z.button01 a:active { ! N! r7 ?: J+ l: O2 {8 H3 `( A
background: #00b7ea; /* old browsers */ ! m/ R2 G9 F+ n3 _& w" h
background: -moz-linear-gradient(top, #00b7ea 36%, #009ec3 100%); /* ff3.6+ */ $ l2 K8 ?7 W1 \6 ^$ \9 b
background: -webkit-gradient(linear, left top, left bottombottom, color-stop(36%,#00b7ea), color-stop(100%,#009ec3)); /* chrome,safari4+ */
4 W( O ^- g: Y, Abackground: -webkit-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* chrome10+,safari5.1+ */ ( n4 ^7 e6 Q0 N9 }! d0 P
background: -o-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* opera 11.10+ */
) l) R+ Z! _/ {% G/ Hbackground: -ms-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* ie10+ */
6 W/ `6 b& j/ }$ A# w2 z4 X4 mbackground: linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* w3c */
; O# l, T. Z4 w1 c* o6 S, p- jfilter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00b7ea', endcolorstr='#009ec3',gradienttype=0 ); /* ie6-9 */ ) J; I# E2 }2 U( m, ^' s" ?0 \
, @) ?: A0 U+ [2 C5 o2 q9 K; f} 2 ^/ [( [& v& i9 D8 ~
* C1 x7 w) i `3 m
.button01:active .bottombottom { 0 U( m- t6 r( b
margin: -20px 0 0 10px; . J, n) i* o) C8 l/ T
} I' ?7 C- x! B
7 H8 m$ s6 O9 [" ]: F7 a$ I r+ U.button01:active .top { ( ~& j6 P# }* y1 {: ^) Q
margin: -70px 0 0 10px;
2 n( m1 U' H$ U9 P}
/ U+ E, ^- q+ a4 ^- F/ x$ w; n e* n- O- i
0 i: e% A# w. C更多网页制作信息请查看: 网页制作 |
|