Internet Explorer CSS background image issue
Saturday, October 4th, 2008
When I code HTML and CSS, I make a habit of not using spaces unless I have to. That’s why I ran into problems with background images in IE7 and older versions. If your like me, this will be a huge pitfall and you’ll be tearing your hair out unless you know about it.
Simply, if you want to declare a repeating image, for example, repeat-x or no-repeat, you need to make sure there is a space before it.
This WILL NOT work in IE
div#examplediv{
background:url(bgimage.png)no-repeat;
}
This WILL work in IE
div#examplediv{
background:url(bgimage.png) no-repeat;
}
