The parent element of the whole page is a centered div limited to a max-width of 960px. All other elements on the page are children of that parent div. The simplified structure is the following:
<div id="parent">
<div id="something"></div>
<div id="wide-div"></div>
<div id="something-else"></div>
</div>
While the parent div shouldn't expand beyond a width of 960px, the div I called "wide-div" here should fill the entire width of the screen. It contains a single image that is wider than the 960px, and it should set a different background color for the entire width of the screen.
I can't easily take that div out of the parent div, it would mess up other parts of my layout and it would make the whole thing rather awkward.
I found a few tricks on how you can achieve this, but none seemed to fit my requirements. My design is responsive, or at least I'm trying to achieve that. The tricks I found relied on knowing the size of the involved elements, which is not fixed in my case.
Is there a way to expand the inner div to the full screen width in a responsive layout?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…