views:

347

answers:

1

I can't figure this out..hopefully someone else can.

I have an image button . The hover effect works fine. However, I have the IE broken image icon over the button image.

Lookie here: Funky Image Funky Image Hover

As you can see...they both work except for that annoying broken image.

Here's my CSS:

.donate-btn{
background: transparent url(/custom/img/donate-btn.png) no-repeat;
overflow:hidden;
height:45px;
width:210px;
float:left;
}
.donate-btn:hover{
background: transparent url(/custom/img/donate-btn.png) no-repeat;
height:45px;
width:210px;
background-position: 0 -45px;
}
+2  A: 

This simply means you are referencing a non-existent image in the source attribute. You should consider using the actual <button> tag instead. It just needs a few extra style attributes to remove borders and padding:

.donate-btn{
    background: transparent url(/custom/img/donate-btn.png) 0 0 no-repeat;
    overflow:hidden;
    height:45px;
    width:210px;
    border: none;
    padding: 0;
    float:left;
}

.donate-btn:hover{
    background-position: 0 -45px;
}

I also simplied your CSS by removing some unnecessary styling in the hover state.

<button class="donate-btn" type="submit"></button>
cballou
@cballou: thanks for the tip. I'm going to try this now.
Loony2nz
@cballou: works great in IE (all versions) and FF, but not Safari (on mac or pc). Thoughts?
Loony2nz
You need to ensure you have `type="submit"` on your button or it will not act as a submit button.
cballou
nevermind :) it works. there was a jquery error in the form that prevented the CSs from loading and other stuff. it works now. funny, FF 3.x is more forgiving than IE and safari
Loony2nz