I am using the sliding doors technique to style buttons on a site I’m making and it seems to be working within Chrome but the background is not displaying for any other browser. My code for the button is below:
<div class="small-white"><a href="#">Done Reading</a></div>
CSS:
.small-white {
float:left;
background:url(images/small-white-sprite.png) right no-repeat;
margin: 15px 5px 0 5px;
padding:0;
display:block;
height:22px;
}
.small-white a {
display:block;
background:url(images/small-white-left.png) no-repeat left;
padding:4px 10px 7px 9px;
color:#333;
text-decoration:none;
float:left;
}
Please advise.
Thanks in advance.
-B
Since you’re using two images anyways (Sliding Doors usually only involves one image; in fact, that’s the point), you can just do this instead to keep transparency:
The
<a>element shouldn’t havefloat: left;(since it has nothing to float around inside the<li>element.) Theline-heightis for centering the text vertically.Using just one image isn’t possible with transparency, but if you know what the background color will be, you can flatten the image on that color, then you’ll be able to use just one image (use the same CSS as now, but add
small-white-left.pngto the left insmall-white-sprite.png, then use that for both elements.)If you want to have the left-most part of the button clickable, put a
<span>element around the text in the<a>element and use this CSS: