I am looking to center a large div that reaches beyond the screen. This concerns having a large .container
div
about 1920px
wide, with the actual content being centered inside .container
in a div
with a class of .content
, about 1200px
wide.
I manage to center one in the other, but centering .container
when it's boundaries are off-screen is not working. It puts the left border against the left border of the browser.
[ | [content] | ]
Legend:
| = screen edge
[ ] = div edge
.content
must always be centered within .container
so that the background's position related to the foreground does not change.
<div class="container">
<div class="content">
<section></section>
</div>
</div>