We could implement some fancy effects by CSS3. There is a very good tutorial written by Joshua Johnson about some mouse hover effects in CSS3.
Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners
The following example is a growing button which will elongate in width when mouse hover.
<!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; } #button1 { /* Basic CSS */ background: #6292c2; border: 2px solid #eee; height: 28px; width: 115px; margin: 50px 0 0 50px; padding: 0 0 0 7px; overflow: hidden; display: block; /* 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)); /* 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; } #button1:hover { width: 200px; } </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='button1' class='buttonText'>Sign Up Now - It's Free!</a> </body> </html>
Kudos to Joshua Johnson for his great examples.
Done =)
Next:
Reference: Joshua Johnson – Four Simple and Fun CSS Button Hover Effects for Beginners
3 thoughts on “CSS3 – Elongate a button on mouse hover”