What I want
two divs: page body (1) and background block (2)
- always block (2560 x 780) px
- page width is 820 pixels and height is variable
- the background block should be behind the body of the page
- background block and page body should be centered
- the background block should not move relative to the body of the page when the window is resized (even by 1 pixel!)
- horizontal scrollbar should not appear for block background
- The background position is not fixed.

Limitations
What i tried
CSS page body:
#pageBody { width: 820px; margin: 0 auto; }
CSS background block:
1. A full-page div that displays a background centered in the center
<div id="backgroundBlock"></div> <div id="pageBody"> </div>
#backgroundBlock { background: no-repeat center 0 url(bg.png); width: 100%; height: 100%; position: absolute; }
But when the window size is odd:
- CSS background is shifted 1 pixel to the left.
- background image looks blurry in Internet Explorer
2. Moved child div
- make the background block a child of the page body (centered)
- make the background block positioned absolute (put it behind the body of the page)
- use negative fields to change the background block.
- make background overflow: hidden to prevent scrollbar for this div
<div id="pageBody"> <div id="backgroundBlock"></div> </div>
#backgroundBlock { background: no-repeat url(bg.png); width: 2560px; height: 780px; position: absolute; margin: 0 0 0 -870px; overflow: hidden; }
But the problem is: a scrollbar appears for the background of the block ...
source share