i want a background image that is larger than the content, which will remain centered with the content, but will not affect the layout (meaning no scrollbars to accomodate the background image). the content *must* be centered using margin: auto; so that the left side will remain flush with the left side of the viewpane, when the viewpane becomes smaller than the content.
I have seen this question asked several times, and have tried quite a few solutions, but none of the accepted answers have actually worked.
**Edit to Clarify**
This question is still a bit murkey, so I will attempt to clarify with some images showing what I need. In these images, green is the background image, red is the main content, and blue is the browser's viewpane.
![enter image description here]
**A:** When the viewpane is smaller than both the background image and the main content, the left side of the content remains flush with the left side of the viewpane, the background image remains centered to the main content, the viewpanes scrollbars will only scroll out to the right edge of the main content (and not to the right edge of the background).
**B:** When the viewpane is larger than both the background image and content, both remain centered to the viewpane.
**C:** When the viewpane is the same size as the main content, the background image should remain centered to the main content, no scrollbars should be present.
: http://i.stack.imgur.com/hiKPp.jpg I don't quite understand what you're talking about.
以上就是Trying to make large background image remain centered with an auto margin centered content div, but bg image should not affect layout的详细内容，更多请关注web前端其它相关文章！