Wednesday, July 3, 2013

Make an Animated-bubble Button With CSS3


Check out this animated button group, cool right? This tutorial will guide you to make such buttons with pure CSS3 (without any Javascript).


Chrome and Firefox and other standard browser is recommended, but IE 9 has some problem.

All you need is button_pg.png, buttons.css, then what you can do is to assign a button type and a button color, like:

Download
Submit
Submit

Color can be: blue, green, orange and grey. Scale can be: small, medium and big. And an option - rounded.

The first thing we need to do is to define a button class. This is the core of this button, as it's used to define the position, font and background properties.

The working part here is to use the moz and webkit provided by firefox and chrome to position the background gradient:


/* BlueButton */
 
.blue.button{
    color:#0f4b6d !important;
 
    border:1px solid #84acc3 !important;
 
    /* A fallback background color */
    background-color: #48b5f2;
 
    /* Specifying a version with gradients according to */
 
    background-image:    url('button_bg.png'), url('button_bg.png'),
                        -moz-radial-gradient(    center bottom, circle,
                                                rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px),
                        -moz-linear-gradient(#4fbbf7, #3faeeb);
 
    background-image:    url('button_bg.png'), url('button_bg.png'),
                        -webkit-gradient(    radial, 50% 100%, 0, 50% 100%, 100,
                                            from(rgba(89,208,244,1)), to(rgba(89,208,244,0))),
                        -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb));
}
 
.blue.button:hover{
    background-color:#63c7fe;
 
    background-image:    url('button_bg.png'), url('button_bg.png'),
                        -moz-radial-gradient(    center bottom, circle,
                                           rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px),
                        -moz-linear-gradient(#63c7fe, #58bef7);
 
    background-image:    url('button_bg.png'), url('button_bg.png'),
                        -webkit-gradient(    radial, 50% 100%, 0, 50% 100%, 100,
                                            from(rgba(109,217,250,1)), to(rgba(109,217,250,0))),
                        -webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7));
}

You can find the source code below:
Source Code

0 comments:

Post a Comment