Let’s continue the tutorial written by Joshua Johnson.
Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners
The 2nd example is a button which has color shift when mouse hover.
<!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>Design Shack Button Examples by Joshua Johnson - http://designshack.net/articles/css/four-simple-and-fun-css-button-hover-effects-for-beginners/</title> <style media='screen' type='text/css'> a.buttonText { color: white; text-decoration: none; font: 18px/1.5 Helvetica,Arial,sans-serif; } #button2 { /* Basic CSS */ background: #d11717; border: 2px solid #eee; height: 38px; width: 125px; margin: 50px 0 0 50px; overflow: hidden; display: block; text-align: center; line-height: 38px; /* Rounded Corners */ -webkit-border-radius: 15px; /* Chrome & Safari */ -moz-border-radius: 15px; /* Firefox */ -khtml-border-radius: 15px; /* Linux browsers */ border-radius: 15px; /* CSS3 */ /* Gradient */ background-image: -webkit-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2)); background-image: -moz-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2)); background-image: -o-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2)); background-image: -ms-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2)); background-image: linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2)); /* Shadow */ -webkit-box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2); box-shadow: 0px 3px 1px rgba(0, 0, 0, 0.2); /* Transition */ -webkit-transition: All 0.5s ease; -moz-transition: All 0.5s ease; -o-transition: All 0.5s ease; -ms-transition: All 0.5s ease; transition: All 0.5s ease; } #button2:hover { background-color: #ff3434; } </style> </head> <body> <p>Tutorial by Joshua Johnson. <a href='http://designshack.net/articles/css/four-simple-and-fun-css-button-hover-effects-for-beginners/'>View original example</a></p> <a href='#' id='button2' class='buttonText'>Sign Up Now</a> </body> </html>
Done =)
Next:
Reference: Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners
3 thoughts on “CSS3 – Color shift button”