tags:

views:

51

answers:

1

So I have a website. I have set a larger image as a background:

html, body {
    height: 100%;
}
body {    
    color: #000;
    font: 100.1% sans-serif;
    background: #033361 url('/images/background2.jpg') center top no-repeat;
}

It works great in Firefox and IE8 but in IE7 the background is moved to the right and there is a horizontal scrollbar.

Can anyone explain this odd behaviour to me and suggest a solution?

My doctype:

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;

UPDATE:

It seems the problem is caused by my wrapper div:

#wrapper {
    width: 1002px;
    margin: 0 auto;
    font-size: .8em;
}

If I comment out the margin, the body background is centered correctly.

+2  A: 
html, body{
   margin:0;padding:0;
}

Try that

Zoidberg
The `html` doesn't have a default margin. The `padding` always defaults to zero.
BalusC
It depends on the browser, it may have a margin, and it may have padding, I have had this same problem.
Zoidberg
Both html and body have zero margin/padding. I'm using a reset css file from here http://meyerweb.com/eric/tools/css/reset/.
Richard Knop
Check my updated answer.
Richard Knop
I meant question :P
Richard Knop
@Richard - so this _did_ resolve your problem?
w3d