I added an input button (type=submit) to a form. This button gets its style from a CSS class that contains a background image. I've used this technique before without problems, but in the site I'm currently developing, the background image doesn't display in IE7 (Vista). Instead, it renders up some default button style. Firefox renders the image correctly. I tested the same class in a div tag and then it displayed fine in IE7. I can't see any significant difference between my older site that uses this technique successfully and the one currently under development. I even tried changing the document type definition to that of the old site (<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">), but it didn't make a difference. I don't know where else to look for differences between these two sites. CSS: .btn_test { height: 45px; background-image: url(gradVert.jpg); background-repeat: repeat-x; border-style: none; display: block; cursor: pointer; } HTML: <input type="submit" name="someName" value="Save" id="someID" class="btn_test" /> I have seen suggestions about using something like this: <input type="image" src="save.jpg" alt="Save" /> however, the text in the button isn't in the image itself, so I need the value attribute to contain the button's text. Can anybody help me to understand what could cause this change of behaviour? It would be greatly appreciated. Thanks.
I found the solution in another thread on this forum, which I missed somehow when searching earlier. I just had to add a border to the style containing my background image. The image is ignored by IE without the border. I don't want to see a border, but fortunately, including a 0px border still works. I simply changed border-style: none; to border: 0px solid #FFFFFF;
My <input type="submit" button using a CSS sprite for an image now works in all browsers down to IE7. Changing from border:none to border: 0px solid red; solved the problem. Thank you for asking your question and then following up by answering it so that the rest of the community can continue to benefit from your research. Thank you! James