Hi,

On page I have a fixed background image that is supposed to remain stationary as the page is scrolled. This works on Firefox but it doesn't seem to on IE.

Does anyone know why?


Thanks,
John

Dani AI

Generated

Short answer: the browser differences usually come from two things — IE quirks (doctype/body/html handling) or IE6 limitations that require a different approach. already hit the practical workaround (Dean Edwards' IE7 script). was right to call out the missing body tag — invalid markup or a quirks-mode DOCTYPE often makes IE behave differently than Firefox.

Checklist to diagnose quickly:

  • Validate the page (fix any missing tags or stray markup). Use the W3C validator.
  • Make sure a standards DOCTYPE is declared so IE uses standards mode.
  • Confirm the background rule is applied to the root element the way you expect (try moving the rule from body to html while testing).
  • Strip other CSS that affects height/positioning (height:100% on html/body, positioned wrappers, z-indexed overlays) and test with a minimal HTML page to isolate the issue.

Practical fallbacks and fixes:

  • If fixing markup and DOCTYPE does not help, use a progressive workaround for older IE: supply the normal CSS for modern browsers and provide an IE-only fallback (conditional stylesheet or small script) that either uses a full-viewport absolutely positioned element behind the content or uses a lightweight polyfill like the one mentioned. For IE6 specifically remember that position:fixed is not natively supported, so JavaScript or conditional CSS is required to emulate it. Keep the fallback simple to avoid layout or performance regressions.

References:

Recommended Answers

All 4 Replies

Nevermind, found the Dean Edward's IE7 hack.


John

Nevermind, found the Dean Edward's IE7 hack.


John

Nice site add to favorites, will come back.
There is CSS way to do it

style="background-image: url; background-attachment: fixed"

one more thing you are missing opening of body in this page not big deal

Well, that is what I have in the Stylesheet. It works on Firefox but not on IE without the script.


John

Should work, I never had problem with it. In my case it did work under IE and also NN.
Try to see if you dont have any mistakes or misspeling somwhere in your 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.