I want to put a background (width = 1250px) centered on page, but the container, should have the width of browser
This center the background:
#container{margin:0 auto;background:#000 url("images/background.jpg") no-repeat;width:1250px;;}
And this set the width of container = the browser
#container{margin:0 auto;background:#000 url("../../../images/background.jpg") no-repeat;width:100%;position:relative;}
How to get centered background image and full page container?
Thanks!
Change your background rule to this:
Or if you want to center it at the top of the page, do this:
Then you can remove the
margin: 0 autobecause it’s useless with a width of 100%.