I have created a codepen here to show my issue: https://codepen.io/nitrokev/pen/abqOoEr
I have a 50 / 50 split layout which works how I want it to with the text content for each column contained to an overall 1260px container but the background expanding beyond this container.
I have tried to create a ⅓ ⅔ split layout to do the same, and it works up to a certain screen size, but as you expand the screen the text content stops aligning with the 50 / 50 content.
I could add media queries to larger size screen to help, but I'm looking for a more elegant solution that works at all sizes
see codepen, as you make the window size larger the text alignment starts to break from the 50 / 50 block above
<h2>Two column contained with full width background and contained content</h2>
<section>
<div class="article-grid">
<article>
<div class="article-inner-grid">
<div class="article-padding">
<header>
<h2>Heading 1</h2>
</header>
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In enim lorem, sollicitudin ut accumsan in, porta sed dui. Sed sagittis est risus, ac luctus odio porta at. </p>
</div>
</div>
</div>
</article>
<article>
<div class="article-inner-grid">
<div class="article-padding">
<header>
<h2>Heading 2</h2>
</header>
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In enim lorem, sollicitudin ut accumsan in, porta sed dui. Sed sagittis est risus, ac luctus odio porta at. </p>
</div>
</div>
</div>
</article>
</div>
</section>
<h2>Two column 1/3 2/3 with full width background and contained content</h2>
<section>
<div class="article-grid">
<article class="one-third">
<div class="article-inner-grid">
<div class="article-padding">
<header>
<h2>Heading 1</h2>
</header>
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In enim lorem, sollicitudin ut accumsan in, porta sed dui. Sed sagittis est risus, ac luctus odio porta at.</p>
</div>
</div>
</div>
</article>
<article class="two-thirds">
<div class="article-inner-grid">
<div class="article-padding">
<header>
<h2>Heading 2</h2>
</header>
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In enim lorem, sollicitudin ut accumsan in, porta sed dui. Sed sagittis est risus, ac luctus odio porta at.</p>
</div>
</div>
</div>
</article>
</div>
</section>
.article-container{
max-width:1200px;
margin-left:auto;
margin-right:auto;
}
section{
margin-bottom:2rem;}
.article-grid{
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: stretch;
}
article{
flex:1;
display: flex;
font-family: arial;
}
article:nth-of-type(1){
background-color:blue;
color:white;
justify-content: flex-end;
}
article:nth-of-type(2){
background-color:red;
color:white;
justify-content: flex-start;
}
.article-inner-grid{
width:calc(#{$container} /2);
max-width: calc(#{$container} /2);
}
.article-padding{
padding:2rem;
}
h2{font-family: arial;}
article.one-third{
flex:1 33%;
}
article.two-thirds{
flex: 2 auto ;
}
article.one-third .article-inner-grid{
width:calc(#{$container} /3);
max-width: calc(#{$container} /3);
}
article.two-thirds .article-inner-grid{
width:calc((#{$container} / 3) * 2);
max-width: calc((#{$container} / 3) * 2);
}
calc() is a way.
exemple with setting a container leaving a max-width of 560px(to adapt to snippet's size) for the direct child. this will be useful later to lay a full background and your content in this max-width area.
To lay the backgrounds is about the same idea, you need calc() to do the math for you : examples within your 1200px and background-image (gradient or image) where you calculate offset position from the center minus the half of the first max-size .
Below you 1200px , a reset or setting background's value elsewhere will be needed (negative value won't be ignored or will disable the rule). If there is simple math to achieve this, i did not think of it .someone else might come with an idea edit added vertical line to simulate borders around content within the 1200px of max-space to use.
I hope that is useful to you and that i understood your question :) Here is the snippet within a codepen you can play with : https://codepen.io/gc-nomade/pen/NWeRNYV