I am having trouble with background images showing up in IE7. While everything looks fine in IE9, firefox, and chrome, when I checked on IE7, I see that none of the

background:url (images/image);

show up in my browser.
Anyone know why, or a work-around for this??
Any help would be GREATLY appreciated!
Thanks.

Dani AI

Generated

Good points from and — the usual culprits for background images disappearing in IE7 are not the browser per se but: invalid CSS syntax that newer browsers forgive, wrong relative paths (relative to the stylesheet file), use of CSS3 features IE7 doesn't support, and layout/floating issues that collapse the element so the background never shows.

Quick checklist and fixes:

  • Validate the background declaration (no stray space between url and the parentheses, correct filename/extension, and no missing semicolons on previous rules). See the CSS background syntax for reference: CSS background on MDN.

  • Confirm the image URL directly in the browser to ensure the server returns 200. Remember paths in a stylesheet are relative to the CSS file location, not the HTML.

  • If the stylesheet uses CSS3 multi-backgrounds or data-URIs, IE7 will ignore them — provide a single-image fallback. (Compatibility details: Can I use — multiple backgrounds.)

  • If the target element contains only floats or has zero height, the background may be invisible. Trigger hasLayout in IE6/7 or contain floats:

.container {
  background: url("../images/bg.jpg") no-repeat left top;
  zoom: 1;        /* triggers hasLayout in IE6/7 */
  /* or use a clearfix/overflow solution to contain floats */
}
  • Use an IE-only stylesheet if needed:
<!--[if IE 7]>
<link rel="stylesheet" href="css/ie7.css" />
<![endif]-->

Other practical tips: clear IE cache after changes, check for overriding rules later in the stylesheet, and inspect the computed styles with an IE7-capable tool or VM. As suggested, posting the relevant HTML/CSS (and the stylesheet path relative to the image) makes diagnosis far quicker.

Recommended Answers

All 2 Replies

If it's just a background image, with no other arguments, have you tried background-image:url(images/image.jpg);

I've never known IE7 to take issue with background images before. It's more likely to be a combination of factors causing the issue.

Do you have a web accessible link you can provide or could you upload the problem page to a web accessible server if not?

Feel free to post the relevant HTML and CSS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.