Search code examples
csshtmlbackgroundpositioningfixed

IE CSS Issues - Nothing is in the appropriate position


I hope this problem is something easily fixable as this website was meant to be a simple project turned into a mess! I'm not sure if this is a unique problem to the code that I've implemented or if it's something that happens often.

I've utilized divs and css to create a website where the background scales to the size of the window. Works exactly how I want it to in Chrome, Firefox, Safari, IE9, etc. BUT in IE < 9 it's being completely unreasonable! Someone please help as I'd really like to avoid coding this from the bottom up.

http://www.mwrenovationsllc.com


Solution

  • Older versions of IE are very picky about having a DOCTYPE set. Make sure your HTML structure has the following layout:

    <!DOCTYPE html>
    <html>
        <head>
            // head contents here...
        </head>
        <body>
            // body contents here...
        </body>
    </html>
    

    If that does not work properly try using a more specific DOCTYPE instead such as:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">