Pure CSS Animated Menu Button Transitions

Adam Khoury Published : November 17, 2014
Last Edited : November 24, 2025
Author : Adam Khoury
Learn to animate buttons easily using the CSS3 transition property to target any and every animate-able property you know of in CSS. We are targeting simple hover behavior to get a roll-over(mouseover) and roll-out(mouseout) animation effect. In order to target more user interactive behaviors(such as click behavior) you can apply one line of JavaScript that fires off the CSS3 transition property at any time in your applications. <!DOCTYPE html> <html> <head> <style> body{ background:#000; margin:0px; } div#menubar1{ padding: 24px; border:#999 1px dashed; } div#menubar1 > a{ font-family:Arial, Helvetica, sans-serif; font-size:17px; background: #333; padding: 12px 24px; color:#999; margin-right: 10px; text-decoration:none; border-radius: 3px; transition: background 0.3s linear 0s, color 0.3s linear 0s; } div#menubar1 > a:hover{ background: #6F8A00; color:#FFF; } </style> </head> <body> <div id="menubar1"> <a href="#">Home</a><a href="#">About us</a><a href="#">Services</a><a href="#">Staff</a><a href="#">Contact</a> </div> </body> </html>