Putting Images Inside a BUTTON Element (HTML & CSS)

Posted by Jimbo on Stack Overflow See other posts from Stack Overflow or by Jimbo
Published on 2010-04-11T10:58:16Z Indexed on 2010/04/11 11:03 UTC
Read the original article Hit count: 420

Filed under:
|
|
|
|

I have a simple button (as shown below) on which I need to display two pictures, one on either side of the button text. Im battling to create the CSS that will work in both Firefox and Internet Explorer! (the button images are coming from a JQuery UI skin file)

CSS

button div{
    width:16px;
    height:16px;
    background-image: url(images/ui-icons_d19405_256x240.png);      
}

button div.leftImage{
    background-position: -96px -112px;
    float: left;
}

button div.rightImage{
    background-position: -64px -16px;
    float: right;
}

HTML

<button><div class="leftPic"></div><span>Button Text</span><div class="rightPic"></div></button>

© Stack Overflow or respective owner

Related posts about html

Related posts about css