Use CSS3 to create a spin-color button

Source: Internet
Author: User

First from HTML:

< Div>
< a class= button > Rotate button </a>
</div>

and now CSS:

. button
{

background: #aaa;
Color: #555;
Font-weight:bold;
font-size:15px;
padding:10px 15px;
Border:none;
margin:50px;
Cursor:pointer;

-webkit-transition:-webkit-transform 1s,opacity 1s,background 1s,width 1s,height 1s,font-size 1s;

-o-transition-property:width,height,-o-transform,background,font-size,opacity,color;
-o-transition-duration:1s,1s,1s,1s,1s,1s,1s;

-moz-transition-property:width, height,-moz-transform, background, font-size, opacity, color;
- Moz-transition-duration:1s,1s,1s,1s,1s,1s,1s;

Transition-property:width,height,transform,background,font-size,opacity
Transition-duration:1s,1s, 1s,1s,1s,1s;

-webkit-border-radius:5px
border-radius:5px;

box-shadow:0 0 2px Rgba (0,0,0,0.5);

Text-shadow:0 0 5px Rgba (255,255,255,0.5);

Display:Inline-block; /* It is important for the button to rotate */
}
Here's the key code conversion properties, which can be defined by width, height, background, color, transparency, and so on. In this example, the attribute is changed every second, according to the transition time attribute.

transition:opacity 2s ease-out, background 1s linear, width 1s, height 1s, font-size 1s;

Next, use this code to trigger the spinning effect by circling the element;

. Button:hover
{
-moz-transform:rotate (360deg);
-webkit-transform:rotate (360deg);
- O-transform:rotate (360DEG);
Transform:rotate (360deg);

Background: #99A411;
font-size:30px;
Color: #fff;
}

Convert the symbol to rotate a 360-degree button, a complete circle. The rest of the code changes the color and font size.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.