PDA

View Full Version : *Inline* buttons that use expanding images as background?



mrbean99
02 Oct 2008, 11:05 AM
I've been using the following method for creating buttons with exmapding image backgrounds:


a.button {
background: transparent url('bg_button_a.gif') no-repeat scroll top right;
color: #FFF;
display: block;
float: left;
font: bold 13px arial, sans-serif;
text-align:center;
height: 32px;
margin-right: 0px;
padding-right: 18px;
text-decoration: none;
}

a.button span {
background: transparent url('bg_button_span.gif') no-repeat;
display: block;
line-height: 22px;
padding: 5px 0 5px 18px;
}
And then to render the button I use:

<a class="button" href="#" onclick="this.blur();"><span>Select</span></a>
However as you can see this requires the button to be a block element that has to float left or right.

You can see an example of the button here (http://bouqka.googlepages.com/button.html) .

Is there a way to have the button appear as an inline element instead while maintaining the same appearance?