Pure CSS Buttons

<html>
  <head>
    <style>
      .but{padding:0px;width:8em}
      .but a{display:block;text-decoration:none;color:black;background-color:#954A00;
            border:3px outset #A67700;border-bottom-color:#6E3C00;border-top-color:#6E3C00;
            padding-top:2px;opacity:1;filter:alpha(opacity=100)}
      .but a:hover{background-color:#954A00;border:3px #603C00 solid;border-bottom-color:#927700;
                      border-right-color:#927700;opacity:0.8;filter:alpha(opacity=80);}
    </style>   
  </head> 
  <body>
    <div class="but"><a href="javascript:alert('Click!')">Sample</a></div> 
  </body>
</html>

The code above is an excerpt of what we use to deliver the sample button above. The salient features of this technique are as follows

It should be noted that the opacity setting has little effect in IE7-. You may wonder why we have chosen to embed anchors inside a division rather than simply styling the division to respond to the mouse cursor hovering over it. This is because, only anchor elements supported the hover pseudo-class prior to IE7. A fringe benefit - we don't need to write an onclick event handler and use JavaScript as would have been required if we had used div hover effects.

We should emphasize that the technique described here is only one of many possibilities. It is certainly possible to create even more attractive effects by using sliding background images etc. In our view, the benefits that accrue from such techniques are far outweighed by the work they entail, the increased server traffic they engender...

Finally, note that creating a selection of color shades to get 3D effects is a great deal easier if done using the HSL model - first select a suitable Hue and then adjust the Saturation and/or Luminosity settings. This is best done using the ExplainThat! color converter.

Jump To...

Colophon