StylizedWeb

Subscribe to our updates:

A Design, WordPress and Tutorials Blog.

Dedicated to helping you learn the art and science of the web.

Create a CSS3 Button That Degrades Nicely

There was a time where creating a nice looking, scalable button required heavy use of images, the sliding doors technique and even some javascript. As it stands a lot of the modern browsers support the css we would like to use to create a nice looking button. Firefox, Safari and Opera all have support for rounder corners, box shadows and text shadows. What used to take six steps and lots of extra mark-up, images and css, now only takes three steps and some simple CSS3.

One of the great perks regarding this technique is that in the event that a user doesn't have a browser that supports the CSS that we will be using, they will still see a nice beveled button - it simply won't look quite as nice.

What We are Going To Do

To create a nice button we have a few major components:

  • A nice background gradient
  • Rounder corners
  • Some nice borders to give it a 3D effect
  • A drop shadow
  • A text shadow (for a nice touch)

In the end we will have a button that looks just like this, only with out using any images behind a few pixel background gradient (and when CSS gradients are supported we can even remove that!).

screenshot

The HTML


<p><a href="#">Example Button</a></p>
<p><a href="#">Example Button</a></p>
<p><a href="#">Example Button</a></p>

As you can see the HTML is very basic, we essentially just need an anchor tag and text. The paragraph is there just to be semantic.

The CSS


.css3button a {
     background: url(background.gif) bottom repeat-x #9eabb3;
     padding: 5px 10px 5px 10px;
     text-align: center;
     font-weight: bold;
     color: #fff;
     text-decoration: none; border: 1px inset #aaa;
     -webkit-border-radius: 8px; width: auto; -moz-border-radius: 8px;  -khtml-border-radius: 8px;  border-radius: 8px;
     -moz-box-shadow: 1px 1px 1px #666;  -webkit-box-shadow: 1px 1px 1px #666;  box-shadow: 1px 1px 1px #666;
     text-shadow: rgba(0,0,0, .5) 0px -1px 0px;
      border-top: inset 1px #ccc; border-left: inset 1px #ccc; border-bottom: solid 1px solid #000; border-right: 1px solid #666;
}

.css3button a:hover  {
     background: #999;
     text-shadow: rgba(0,0,0, .5) 0px 1px 0px;
}

The CSS is a bit more complicated, but still fairly simple. We are really just adding a repeating background image, adding some rounded corners, as well as box and text shadows. The borders add a bit more depth / shading and ensures that if the CSS properties are not supported that the element still retains a beveled appearance.

background

The background image is simple gradient to give the button some depth, in this case I used the following image:

That Simple

That is how easy it is. If you want to play around with the borders you can end up with some pretty nice effects as well.

Examples

Example Button

Example Button

Example Button

Example Button


Leave a comment on Stylized Web Have some feedback? Leave a comment

78 Comments So Far

  1. Pingback: Most Hot Latest CSS And CSS3 Buttons, 110 Best Of The Best Sets !

  2. Pingback: Britney Spears’ Tourmates Nervo Tease New ‘Club Records’ | Singapore Transport Blog

  3. Pingback: Lady Gaga To Release Photo Book | Singapore Schools Directory. Primary Schools. Secondary Schools. Poly. Junior Colleges. Universities

  4. Pingback: Photos | Ke$ha Exclusive Photos | MTV Style | Pets In Singapore. Find Pet Foods and Pets here!

  5. Pingback: Amazon Sends Kindle to the Cloud | Singapore Catering Directory

  6. Pingback: ’30 Minutes Or Less’ Cheat Sheet: Everything You Need To Know | Singapore Casino Information. Integration Resorts.

  7. Excellent write-up tends to make continual development, many thanks discuss, the particular deposition regarding information is always to retain studying, consideration will be the beginning of success.

  8. Pingback: Spotted: Miranda Kerr and Flynn Touch Down | Pets In Singapore. Find Pet Foods and Pets here!

  9. Pingback: Ke$ha Touched By Fan’s Tattoo | Singapore Schools Directory. Primary Schools. Secondary Schools. Poly. Junior Colleges. Universities

  10. I just stopped in to tell you I really appreciated the read and shall be dropping by from time to time now.

  11. So nice your post, I certainly love this website, come on.

  12. This is awesome! nice job I love it!

  13. Pingback: How Secure is My Password lets you know just that | Singapore Catering Directory

  14. Pingback: 24 best tutorial how to create sexy css3 buttons – CSS | Leoc magazine

  15. this is very useful information , thank you

  16. good job buddy , very useful information

  17. I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

  18. christian louboutin

  19. melody. Using electronics aswell as acoustics, he delivers surely an independent netlabel masterpiece. Jumping from abstract piano & acoustics (pawlow) over folk-flavoured electronica (takt short takt) to modern pop music (d.kitt), this album can’t put into one certain genre. As Aerotone told us on the release website that “Frerk is a bedroom- and first trial production…” we know, that these ones are very often the

  20. Pingback: 30 Excellent CSS3 Buttons Tutorials & Resources | Web Design Habits

  21. Pingback: Top 40 CSS3 Tutorials and Techniques for Creating Cool Css3 Buttons | Free Software, Jquery, Desiging,Template, Tech News, Artie,music,Photoshop tutorial

  22. Pingback: Blogging Well » Blog Archive » 20 CSS3 Tutorials and Techniques for Creating Buttons

  23. Pingback: Vans Rata Vulc Shoes

  24. Pingback: UGG 5325

  25. Those who want to enter the world healthy and permanent form, which is a product of choice for African Mango, now in Turkey. Because people prefer to use a 100% herbal product that helps people to enter the African Mango form a single product.

  26. Pingback: CSS And CSS3 Buttons, 110 Best Sets ! | Free Website Template Center

  27. bir bilmecem var usaklar

  28. r10 selamlar devam sabaha kadar

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>