Due some performance issues, I don’t recommend using these buttons anymore. You may try instead my latest CSS3 patterned buttons.
Recently I talked about CSS cross-browser gradients and last week I wrote again about CSS3 gradients. So what I’m going to do today? I will show you how to put the CSS gradient feature in practical use.
In this article you will see how you can create a set of gradient buttons just with CSS (no images).
Oh no! Not another CSS3 buttons!
That’s what you may say but, oh yes :) … This is another buttons set, powered by almighty CSS3 (and IE gradient filters).
Features
- Scalability - Scale the buttons using font-size.
- Adjustability - Change padding and font-size and there you go.
- Flexibility - Apply the styles to any HTML elements.
- Fallback styles - Graceful degradation for other browsers.
- Usability - Normal, hover and active states are available.
“How it’s made”
- RGBA color mode
- CSS box shadow
- CSS text shadow
- Rounded corners
- Gradient patterns thanks to @leaverou for its enlightening article about CSS3 gradients techniques
HTML structure
Let’s see how the HTML looks for the blue button for example:
Multiple classes are used in order to have minimal HTML and CSS files.
The top border could have been achieved with an inset
box-shadow but, this way the CSS3 buttons will degrade graceful, as you will see later in this article.
The CSS
Blue button:
And so on for the other buttons…
On browser support
Mozilla 3.6+
Full support, including CSS3 gradient patterns (though I noticed some performance issues when page is rendered).
Webkit (Safari, Chrome)
The buttons are rendered very nice on Webkit browsers.
Opera 11
Unfortunately, Opera lacks any support for CSS gradients, still the buttons render very nice as other CSS3 features are not missing here.
IE6, IE7, IE8
With filters
, CSS gradients are possible also when talking about IE6 or IE7.
IE9
Besides the other IE browsers, IE9 supports rounded corners and box shadows, although the corners don’t look perfect as you can see below.
That’s all!
It would be recommended to use conditional comments when using filters. This way your CSS file will be cleaner and you will avoid performance issues.
Having said that, I hope you enjoyed this article and if you did don’t forget to follow me on Twitter or to leave a comment below!