为大家分享了很多款纯css3实现的实用按钮。今天给大家带来一款基于css3的动画按钮。实现的效果图如下:
/ @% a8 B/ [( k; @
: N a: U2 K* H$ B/ a# X实现的代码。
$ q s% m0 {4 uhtml代码:
% o3 ]* u, N8 @" I; G5 Z1 ^xml/html code复制内容到剪贴板, g) Z/ R9 l" ~6 a o! e& \2 o
<div class=share-buttons>
# W; i4 R* q3 `6 C1 Q6 B$ X<div class=share-button> 9 X8 T: c0 r0 R' G" d2 L
<div class=share-button-secondary>
: e' |1 A0 e% H<div class=share-button-secondary-content> 7 k2 F5 G5 h6 C4 q- @
share on twitter
, D4 U) n$ J7 {1 J. i q+ o</div> w. I, K+ [ T ^/ C
</div>
* u8 _$ y7 q$ T' U<div class=share-button-primary> 5 b0 G. k# H# P: m# s9 p% N
<i class=share-button-icon fa fa-twitter></i>
4 j1 u4 V4 B5 D, R6 d$ H</div> & j" ?* i/ d; g: B1 l
</div> 7 K9 |/ a5 h& o/ R# p" x
<div class=share-button>
. y2 q! i. K1 k% d, M<div class=share-button-secondary>
, r [) g% P, V- m* `0 _<div class=share-button-secondary-content> 6 y2 b L, b: q1 I% {0 c
share on facebook
: K; X. r" s- d8 T) g0 n</div> 2 [+ ^ m5 D# @8 a4 [
</div>
7 F8 R6 E! r: f& F {! a* d0 w8 m<div class=share-button-primary>
- o# A. E3 n# F& p<i class=share-button-icon fa fa-facebook></i> # @1 c+ `, y4 G9 T2 Q- z0 W
</div> ; w' e$ \0 e5 t9 F
</div>
* H& _8 w5 j3 z; B! K3 o" q<div class=share-button> 9 I: m0 E3 w+ E8 f9 b7 r. i
<div class=share-button-secondary>
0 n4 c. I' _) {) M. X" O<div class=share-button-secondary-content>
5 ?/ U# y& d) @8 b* @8 Opin on pinterest $ F* v, b2 x ^
</div>
9 Y: [! c0 J7 l; d</div> 7 J" W7 r3 v: C1 s* Q) n
<div class=share-button-primary>
7 R6 N6 r" V4 R! {7 x<i class=share-button-icon fa fa-pinterest></i> - Z# ~! \( ]# q& t% X% Z! o: R
</div> 3 t8 r5 |. u# T+ U/ F3 j
</div>
" l& ]4 X+ h. o* N( a' ~" X# t<div class=share-button> 0 S% {/ ]& R8 I
<div class=share-button-secondary> . W+ f7 w. E5 e% L- S6 m' {7 k
<div class=share-button-secondary-content> , E/ [% D; {% J4 c: l7 v
share on tumblr
! ]: {0 M7 h/ U. a</div> 2 M# H/ r9 p4 g% R$ x
</div> - [3 k) ]- l8 }$ a! k' T) I
<div class=share-button-primary>
$ w* m$ }3 i1 ?; d* ?, Y<i class=share-button-icon fa fa-tumblr></i>
6 y7 w0 f; {, A8 ~4 H9 T* X' G</div>
% o7 V5 {' C: Y2 u9 v</div> * E6 V! ~$ z0 W
<div class=share-button> ' X$ [ a4 n3 s- Y
<div class=share-button-secondary> - |, o) \* V: A
<div class=share-button-secondary-content> , i Y4 D1 C* @. V9 b# K
share on google+ 5 X9 E2 E- T" v4 ^2 ]
</div>
( a( n9 K- u: k6 [- T2 k7 F</div>
: L2 }5 {# L. a: U<div class=share-button-primary>
% x/ }: J9 Q b5 B9 y9 R: Z0 O<i class=share-button-icon fa fa-google-plus></i> 9 _# N! T# `: }2 W/ V2 L; K* w% H
</div> % k$ X; g+ v$ K6 A, m
</div>
0 g; F9 X7 g% g( J/ N! j# t</div>
& l! a- U( W% s8 N1 wcss3代码:
$ d! g2 u( U# k# }: ?css code复制内容到剪贴板 U/ `5 v o6 H, `( B1 P, a
body
+ {3 L9 P5 M/ ]- i% [# a; J{
% B. Y/ x# }0 W0 f, M; F! fbackground: -webkit-linear-gradient(0deg, #ff8008 10%, #ffc837 90%);
4 Y$ z- O& E4 B T3 f3 V* vbackground: linear-gradient(90deg, #ff8008 10%, #ffc837 90%); ' {/ T5 d0 c9 C- s( I9 t
padding: 2em; & T4 b5 g- g+ t. P+ L6 o- s
text-align: center; , E" ?) c0 b0 k
} 5 s l( d4 Y" }# _, J
" K. k S! s: o7 O*
4 b& y, M4 _" {7 R" a{ $ b* A3 s: D7 G& n
-moz-box-sizing: border-box; * Z, H, G% q1 B1 v
box-sizing: border-box; ; M( }% [, Q/ _# K
} $ T B$ ]& _0 Y% E9 \; q' Z
& g% R: u+ f/ r' q: g% L9 T
.share-buttons
: G8 a8 A% W: S: U# V; P{ $ [% o5 p% t1 N/ I3 o( }
position: absolute;
! o9 b# m2 k3 @2 U4 d2 ^% Fwidth: 300px; $ E9 U4 u5 }4 F# O& n
height: 212px; - \5 w% k" J3 W! Q* T$ F
padding-left: 135px;
+ x' Q# `- ]( o5 O; A6 d8 T7 ltop: 50%; 8 t5 V9 i; m+ ~
left: 50%; ( h& P% l, u' H/ a5 G0 m) u
margin-left: -150px;
2 j* l+ N2 g j$ N _5 zmargin-top: -106px; / [1 `! x4 r9 ] m
} 3 s D$ z& w* g' }( q8 G& Q( z
.share-buttons .share-button + o% f0 m; T9 S7 t( @
{
' W" C2 J6 L8 [2 _; h- Jfloat: left;
?. R6 W7 B" `7 O x/ Rmargin-top: 15px;
+ K" B9 \" M- C; U8 \}
# b9 M; r, Z8 Z8 X.share-buttons .share-button:first-child
; @9 H A/ F, ~; ?" Q' o, L{
& i I- `2 r+ J) Amargin-top: 0; ( ^& v& c, e3 I' j
} # I ^! j. ^; z& n
.share-buttons .share-button:after
$ V7 ~) z! r9 [% Q) u% L+ J7 d. u{
7 w$ ?5 o2 i1 G% `0 F. \( jclear: both; " j; Q+ L& Q$ U" k& Y7 G
display: table; , E1 S: J8 @- H- x% @: o2 F. ~
}
8 Q" H$ N$ g& u6 e9 L
( p# c* a0 j7 g4 o4 Z.share-button ; h. z$ `8 M% _+ M G2 ?
{ 8 D6 o! i. Z! N: P) a; \
display: block;
( j5 H1 |2 O9 D8 n [- rposition: relative; ( Z' M# Y* J" E+ s9 v
height: 30px;
d0 E1 O$ q X}
2 Z3 X+ C; @( S: G4 \, Z.share-button:hover . Q9 R; p( c0 v9 H8 [
{ & U* h1 @: L# L5 O+ n
cursor: pointer;
$ s6 r. W8 F# g9 Z} " n0 G) e/ o3 {, b* E0 K" f
.share-button:hover .share-button-primary % x2 a' p* \2 E- b e) k
{ * @0 R5 S7 u) c4 O5 L5 K
box-shadow: 1px 0 0 0 rgba(0, 0, 0, 0.1);
9 ^4 h7 {0 L: [; v' _} ; r% `* ~1 S; K, X( O; C
.share-button:hover .share-button-secondary-content + u& B! m2 B3 V1 ^7 ^
{
1 k6 v4 O! O' T9 U# a-webkit-transform: translate3d(0, 0, 0);
9 I- Q8 `; _" Q6 u- G9 C$ u3 `transform: translate3d(0, 0, 0);
9 f% Q; U1 l* j1 _- W% E( Q* y} & H: U! @ D4 X% [2 S
m1 i+ ?# n8 v: n# [& R( X% N! X.share-button-primary
, h7 o/ b7 }2 `{ 7 _( _0 N+ f6 @0 |, k, }; u
position: absolute;
$ B5 r8 W2 D/ i% m& e0 o0 b* s2 H% Ubackground: #fff;
' C U! d+ j9 _$ Y0 p2 Iwidth: 30px;
/ t. e m. A* w xheight: 30px; 5 K8 k$ y/ ~1 c3 L- g+ L
border-radius: 15px; 7 A+ G4 ~& y8 o2 Z
left: 0;
1 _2 H" |' ]0 c: x' d/ k6 gtop: 50%;
" U8 c5 m' U6 E; v. Emargin-top: -15px; 4 P' a! l5 O2 L' Y8 {3 y. D
}
! w! C2 _ j/ k( B% m
$ ]/ O: ]9 J5 t: h- {* U.share-button-icon + [4 L8 I" Z- q0 ~2 e% t$ z
{
1 X% Q* U3 E0 o/ g0 jdisplay: block;
- a/ j! `, c: n# Pcolor: #242424;
+ {% J) x ^5 m- e6 C) rposition: absolute;
3 ^9 b: O e, K$ N% [* Wwidth: 30px;
: R6 q# F5 f! K7 r" b* Fline-height: 30px; $ f& M2 k2 r$ _5 N" o
font-size: 16px; 7 k" i9 a% e+ N: C6 T% ~
margin-top: 1px; ( `4 P4 ~2 }6 K. H9 L% t" e
} 6 l5 ^1 t+ {) S& |; a
- {! E* J% i' o0 D.share-button-secondary
3 `; A! Q1 n$ R% Y; o2 d{
4 u% X+ g9 E( E8 Q6 g) m' {- ^) Koverflow: hidden;
5 b" H+ y7 ?& k$ T9 e$ ]& ]' Zmargin-left: 15px; : Y, e) \) C1 c! D
height: 30px;
% k: f, l" v: e* Z9 |4 r/ A}
0 R; f( S! u; c5 y/ d8 t2 o- U0 s: c* \* [5 N5 I
.share-button-secondary-content
/ \7 Z2 Z5 G1 w% e1 _' D{ 1 U. @- f& m% k' J- @! r+ o! j
font-family: sans-serif;
9 Z' E& M3 g7 Yfont-size: .75em;
3 T& @1 h# b) P- |4 I& H6 n( b! ^8 O4 Gbackground: #fff;
F P4 z9 a! s# w! l) K$ Kdisplay: block; 0 w8 Y5 V( `6 L/ Z: ]3 l
height: 30px;
) z1 B; M, @) Ytext-align: left;
z' c6 K, d# \padding-left: 24px; 7 b. _1 o" Z' n$ Q6 L/ Z0 v( O
padding-right: 18px;
# }3 E+ M: v+ B& G6 `0 cline-height: 30px; # ]( s7 C' m; x" m
color: #242424;
5 o# O; `* _8 N `& p; Uborder-radius: 0 15px 15px 0; - F2 J% d4 u7 x" V% d2 ^2 b( T
-webkit-transform: translate3d(-100%, 0, 0);
' ?& X7 X8 ?5 V- xtransform: translate3d(-100%, 0, 0);
7 \: b4 c6 v( }* Y6 g-webkit-transition: -webkit-transform 175ms ease; * v& g3 Q: |) z% i" t
transition: transform 175ms ease; # d; D+ {' a5 ]8 c* ^
}
4 K, }% L, t- m/ f" }% Y9 |" b! I% I' |* r
更多网页制作信息请查看: 网页制作 |
|