The 3rd example by is a background shift effect. This effect manipulate the background-position attribute.
Again, thanks Joshua Johnson for his great examples.
Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners
You can use the following image bkg-1.jpg as the button background.
Complete example.
<!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>Design Shack Button Examples by Joshua Johnson</title> <style media='screen' type='text/css'> a.buttonText { color: white; text-decoration: none; font: 18px/1.5 Helvetica,Arial,sans-serif; } #button3 { /* Basic CSS */ background: transparent url('bkg-1.jpg'); background-position: 0 0; text-shadow: 0px 2px 0px rgba(0, 0, 0, 0.3); font-size: 22px; height: 58px; width: 155px; margin: 50px 0 0 50px; overflow: hidden; display: block; text-align: center; line-height: 58px; /* Rounded Corners */ -webkit-border-radius: 5px; /* Chrome & Safari */ -moz-border-radius: 5px; /* Firefox */ -khtml-border-radius: 5px; /* Linux browsers */ border-radius: 5px; /* CSS3 */ /* 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.8s ease; -moz-transition: All 0.8s ease; -o-transition: All 0.8s ease; -ms-transition: All 0.8s ease; transition: All 0.8s ease; } #button3:hover { background-position: 0 150px; } </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='button3' 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 – Background shift button”