You must be familiar with css button with hovered and pressed-style, we always meet them around the internet world with ease. Fortunately, we can make them with a very simple css technique. By using built-in css pseudo selector (:hover and :active) we can manipulate a boring link navigator into a cute one.
As i said before we’ll use css pseudo selector, :hover and :active. :hover is a pseudo-selector to read user’s hovering action to our element while :active read pressing action. To make the button we need button image sprites as the background image, the image sprites divided into three states : normal state, hover state and press state.

We’ll put the image sprite as background image and play it’s position based on the user action, for example in the normal state the background image position will be set to ‘top left‘, hover state set to ‘center left‘ and press state set to ‘bottom left‘. These setted position will automatically set our background image position as our request.

We’ll set the html into following script :
<a class="yellow-button" href="#">This is a Yellow Button</a>
And the last script is CSS :
.yellow-button { display:block; width: 201px; height: 46px; padding: 21px 0 0 0; background: url('images/yellow-button.png') top left no-repeat; margin-bottom: 2em; margin-right: 2em; float: left; } .yellow-button:hover { background-position: center left; } .yellow-button:active { background-position: bottom left; padding-top: 22px; }
Ok, that’s it, thank you for reading! You can get regular useful updates about web-stuff by subscribing webstuffshare RSS feed or webstuffshare FREE Email subscription. If you like this post, your sharing and feedback would be very appreciated
[Code Snippet] CSS : Hover and Press Button (via @hdytsgt)
[Community News] jQuery Fundamentals
RGraph : HTML5 Canvas Graph Library
jQuery Plugin : jQuery iPhone UI
Pikachoose : Another jQuery Plugin for Image Gallery
HTML5 Security Cheatsheet
[Community News] How to turn any jQuery plugin into a Wordpress one
Zoom Your Element Using Zoomooz.js
[Community News] Build a Flash-like Game With Scripty2
[Community News] CSS3 Transitions available on Firefox 3.7
[Community News] CSS from the Ground Up
- How To Create iPhone-Style Navigation (Part I)
This post has got 23 shouts so far - jQuery Plugin : jConfirmAction
This post has got 33 shouts so far - iPhone-Style Navigation:AJAX + Rotate (Part II)
This post has got 12 shouts so far - Howto Create Mac-like Login Form
This post has got 7 shouts so far - Simple Flip Puzzle Effect with jQuery
This post has got 6 shouts so far - Implement Password Strength Meter & Gauge.js
This post has got 8 shouts so far - Create Animated Navigation Menu From Stratch
This post has got 7 shouts so far - Stylize Your Own Checkboxes
This post has got 15 shouts so far
- nice tut but I am newbie and I wonder how to make more one or two drop-menu
by b52 on Simple CSS3 Dropdown Menu - @andrew : Until now jConfirmAction still in development for...
by Hidayat Sagita on jQuery Plugin : jConfirmAction - sorry i must correct my prev post the links are without href blah blah
by andrew on jQuery Plugin : jConfirmAction - thanks! CSS 3 rulit))
by web desing on Photoshop Effect vs CSS3 Properties - Good!Thanks for share with the resource!
by ChunPIG on Free Web UI Element Pack




CSS Brigit | [Code Snippet] CSS : Hover and Press Button
[Code Snippet] CSS : Hover and Press Button…
You must be familiar with css button with hovered and pressed-style, we always meet them around the internet world with ease. Fortunately, we can make them with a very simple css technique. …
2010-03-19 유용한 링크 | We are connected
[...] [Code Snippet] CSS : Hover and Press Button tweetmeme_url = 'http://blog.werconnected.info/2010-03-19-%ec%9c%a0%ec%9a%a9%ed%95%9c-%eb%a7%81%ed%81%ac/';tweetmeme_source = 'jsveron23';tweetmeme_style = 'compact'; Tag(s): bookmarks Trackback URL: URL [...]
This Weeks Twitter Design News Roundup N.29 | Yooxe
[...] Design Code:[Code Snippet] CSS : Hover and Press Button ( via webstuffshare.com [...]
This Weeks Twitter Design News Roundup N.29 | DesignerLinks | Home to Web design news, jQuery Tutorials, CSS tutorials, Web Designing tutorials, JavaScript tutorials and more!
[...] Design Code:[Code Snippet] CSS : Hover and Press Button ( via webstuffshare.com [...]
Gabriel
I was looking for a proper solution for this for so long. Thanks a million!