No replies
blizzy
Offline
newbie
Last seen: 9 years 35 weeks ago
Timezone: GMT+1
Joined: 2010-12-09
Posts: 1
Points: 2

Hi,

I want to center (horizontally) a div using margin:auto but also make the background expand "infinitely" to the right, without affecting the page width and scrollbars.
Right now I use margin:auto but it depends on a fixed width, say 1000px, which crops the background to 1000. When the browser window is larger than 1000 the background ends and there's a white space. I'm using a 1500px background but if I set the div width to 1500, the browser adds a scrollbar and thinks the page and content is 1500px wide, even though I just want it to be 1000.
My site can be found here: URL, but as you can see the page doesn't resize and scroll very well, since the background is cropped to a fixed size instead of flowing freely to the right.