1. 程式人生 > >動態變化的按鈕,按鈕漸變色,動態變化顏色

動態變化的按鈕,按鈕漸變色,動態變化顏色

效果如圖:
<!DOCTYPE html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <meta name="keywords" content="radioactive buttons, rgba buttons, CSS3 buttons, animated css buttons" />
<meta name="description" content="Create killer button focus effects using some very simple RGBa colors and -webkit-animations." /> </head> <style> .transparent.header { background: #333; } section[role="main"] { background: #333;
color: #fff; } section[role="main"] h1 { color: #fff; } section[role="main"] h2 { color: #fff; } section[role="main"] h3 { color: #fff; } .button { margin-right: 0.5em; border-radius: 4px; } ol {
margin-left: 2em; } div#sidebarAd.cleanslate { background: #444 !important; color: #fff !important; } div#sidebarAd.cleanslate .ad-sponsor { color: #ccc !important; } .zurb-footer-top { background: #222; }
@-webkit-keyframes bigAssButtonPulse { from { background-color: #749a02; -webkit-box-shadow: 0 0 25px #333; } 50% { background-color: #91bd09; -webkit-box-shadow: 0 0 50px #91bd09; } to { background-color: #749a02; -webkit-box-shadow: 0 0 25px #333; } }
@-webkit-keyframes greenPulse { from { background-color: #749a02; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #91bd09; -webkit-box-shadow: 0 0 18px #91bd09; } to { background-color: #749a02; -webkit-box-shadow: 0 0 9px #333; } }
@-webkit-keyframes bluePulse { from { background-color: #007d9a; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #2daebf; -webkit-box-shadow: 0 0 18px #2daebf; } to { background-color: #007d9a; -webkit-box-shadow: 0 0 9px #333; } }
@-webkit-keyframes redPulse { from { background-color: #bc330d; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #e33100; -webkit-box-shadow: 0 0 18px #e33100; } to { background-color: #bc330d; -webkit-box-shadow: 0 0 9px #333; } }
@-webkit-keyframes magentaPulse { from { background-color: #630030; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #a9014b; -webkit-box-shadow: 0 0 18px #a9014b; } to { background-color: #630030; -webkit-box-shadow: 0 0 9px #333; } }
@-webkit-keyframes orangePulse { from { background-color: #d45500; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #ff5c00; -webkit-box-shadow: 0 0 18px #ff5c00; } to { background-color: #d45500; -webkit-box-shadow: 0 0 9px #333; } }
@-webkit-keyframes orangellowPulse { from { background-color: #fc9200; -webkit-box-shadow: 0 0 9px #333; } 50% { background-color: #ffb515; -webkit-box-shadow: 0 0 18px #ffb515; } to { background-color: #fc9200; -webkit-box-shadow: 0 0 9px #333; } }
a.button { -webkit-animation-duration: 2s; -webkit-animation-iteration-count: infinite; }
.green.button { -webkit-animation-name: greenPulse; -webkit-animation-duration: 3s; } .blue.button { -webkit-animation-name: bluePulse; -webkit-animation-duration: 4s; } .red.button { -webkit-animation-name: redPulse; -webkit-animation-duration: 1s; } .magenta.button { -webkit-animation-name: magentaPulse; -webkit-animation-duration: 2s; } .orange.button { -webkit-animation-name: orangePulse; -webkit-animation-duration: 3s; } .orangellow.button { -webkit-animation-name: orangellowPulse; -webkit-animation-duration: 5s; }
.wall-of-buttons { text-align: center; margin-top: 2em; margin-bottom: 2em; } </style> <body> <div class="row"> <div class="large-12 columns wall-of-buttons"> <a class="green button">Look at me!</a> <a class="blue button">Click me!</a> <a class="magenta button">Hi ho, Silver!</a> <a class="green button">Look at me!</a> <a class="red button">I'm Glowing!</a> <a class="magenta button">Hi ho, Silver!</a> <a class="orange button">Call to Action</a> <a class="magenta button">Hi ho, Silver!</a> <a class="green button">Look at me!</a> <a class="orangellow button">Got clicks?</a> <a class="blue button">Click me!</a> <a class="red button">I'm Glowing!</a> <a class="blue button">Click me!</a> <a class="magenta button">Hi ho, Silver!</a> <a class="orangellow button">Got clicks?</a> <a class="red button">I'm Glowing!</a> <a class="orange button">Call to Action</a> <a class="green button">Look at me!</a> <a class="orangellow button">Got clicks?</a> <a class="red button">I'm Glowing!</a> <a class="blue button">Click me!</a> <a class="orangellow button">Got clicks?</a> <a class="blue button">Click me!</a> <a class="red button">I'm Glowing!</a> <a class="orange button">Call to Action</a> <a class="orangellow button">Got clicks?</a> </div> </div> </body> </html>