Height:auto expanding with min-height - html

I am having issues getting .gridSecBlock to expand with height:auto in my viewport < 640. If you click on the jsfiddle link below and modify the viewport to be less than 640 pixels, you will see that the .gridSecBlock for the content .gridText isn't expanding like it should with height: auto. I have a min-height set, but do not want to have to adjust this for so many media queries.
Then for some reason my total-center class isn't centering the .gridSecBlock vertically for the content blocks.
Does anyone see what I am doing wrong?
Jsfiddle link to see mobile viewport
.total-center {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100%;
}
.left {
float: left;
}
.right {
float: right;
}
.gridSecCont {
display: block;
height: 70vh;
}
.gridSecWrap {
width: 100%;
position: relative;
}
.gridSecBlock {
width: 50%;
height: 100%;
display: inline-block;
vertical-align: top;
position: relative;
overflow: hidden;
}
.gridSecBlock img {
width: 100%;
height: 100%;
object-fit: cover;
}
.gridSecText {
text-align: left;
}
.gridSecBlockWrap {
width: 65%;
}
/*---------------------------------------------- MEDIA QUERY 640 --------------------------------------------*/
#media screen and (max-width:640px) {
/*--- Grid Section --*/
.gridSecCont {
display: block;
height: auto;
}
.gridSecBlock {
width: 100%;
height: auto;
display: block;
min-height: 270px;
}
.gridSecBlockWrap {
width: 75%;
height: auto;
padding: 10px 0;
}
}
<section id="gridSec">
<div class="gridSecWrap">
<div class="gridSecCont">
<div class="gridSecBlock left">
<img src="https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1513398884/cacimba-do-padre-beach-brazil-365BEACHES1217B.jpg?itok=DUFLlpiW">
</div><div class="gridSecBlock right gridText">
<div class="total-center gridSecBlockWrap">
<p class="dG gridSecText">
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
</div>
</div>
</div>
<div class="gridSecCont">
<div class="gridSecBlock right">
<img src="https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1513398884/cacimba-do-padre-beach-brazil-365BEACHES1217B.jpg?itok=DUFLlpiW">
</div><div class="gridSecBlock left gridText">
<div class="total-center gridSecBlockWrap">
<p class="dG gridSecText">
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
</div>
</div>
</div>
</div>
</section>

I think you can achieve what you are going for much easier with flexbox. I cleaned it up a bit and got rid of seemingly unnecessary divs and other styles.
Threw it into a codepen as well: https://codepen.io/samandalso/pen/MXbYNz
.gridSecCont {
display: flex;
justify-content: center;
align-items: center;
height: 70vh;
}
.gridSecWrap {
width: 100%;
position: relative;
}
.gridSecBlock {
overflow: hidden;
flex-basis: 50%;
}
.gridSecBlock img {
width: 100%;
height: 100%;
object-fit: cover;
}
.gridSecText {
text-align: left;
flex-basis: 50%;
padding: 3rem;
}
/*---------------------------------------------- MEDIA QUERY 640 --------------------------------------------*/
#media screen and (max-width:640px) {
/*--- Grid Section --*/
.gridSecCont {
display: block;
height: auto;
}
.gridSecBlock {
width: 100%;
height: auto;
display: block;
min-height: 270px;
}
.gridSecBlockWrap {
width: 75%;
height: auto;
padding: 10px 0;
}
}
<section id="gridSec">
<div class="gridSecWrap">
<div class="gridSecCont">
<div class="gridSecBlock left">
<img src="https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1513398884/cacimba-do-padre-beach-brazil-365BEACHES1217B.jpg?itok=DUFLlpiW">
</div>
<div class="gridSecBlock right gridText">
<p class="dG gridSecText">
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
</div>
</div>
<div class="gridSecCont">
<div class="gridSecBlock right">
<img src="https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1513398884/cacimba-do-padre-beach-brazil-365BEACHES1217B.jpg?itok=DUFLlpiW">
</div>
<div class="gridSecBlock left gridText">
<div class="total-center gridSecBlockWrap">
<p class="dG gridSecText">
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
</div>
</div>
</div>
</div>
</section>

Related

Superimpose 2 DIV

I want realise this page
this is my work
the probleme is i can't superimpose the div who contain the text "LUCETTE" under the div who contain the picture
my code html:
* {
font-size: 16px;
font-family: 'playfair_displayblack';
}
.container {
position: relative;
}
.central {
display: flex;
width: 66vw;
height: 55vh;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, 50%);
z-index: 2;
}
.left {
flex: 1;
}
.right {
flex: 2;
background-color: #2b563b;
overflow: hidden;
}
.belle {
max-width: 100%;
max-height: 100%;
display: block;
border: 9px solid whitesmoke;
}
.bas {
display: flex;
flex-direction: row;
}
.pied {
bottom: 100px;
width: 90vw;
height: 30vh;
margin-left: auto;
margin-right: auto;
}
.titre span {
text-align: center;
text-transform: uppercase;
font-size: 16rem;
font-weight: bolder;
font-family: 'playfair_displayitalic';
position: absolute;
bottom: 0;
z-index: -1;
}
<main class="container">
<div class="central">
<div class="left">
<img src="images/chantal.jpg" alt="" class="belle">
</div>
<div class="right">
<section>
<header>
<h1> <span>strategy</span> </h1>
</header>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
</div>
</div>
<div class="pied">
<h1 class="titre"> <span>lucette</span> </h1>
</div>
</main>
THANKS .
i'm tryng to superimpose the div who contain the image on top of the div who contain the text "LUCETTE".
but the text "LUCETTE" is on the top of my page .
Try this:
* {
font-size: 16px;
font-family: 'playfair_displayblack';
}
.container {
position: relative;
padding-top: 100px;
height: 100vh;
display: flex;
justify-content: center;
}
.central {
display: flex;
width: 66vw;
height: 55vh;
z-index: 2;
}
.left {
flex: 1;
}
.right {
flex: 2;
background-color: #2b563b;
overflow: hidden;
}
.belle {
max-width: 100%;
max-height: 100%;
display: block;
border: 9px solid whitesmoke;
}
.bas {
display: flex;
flex-direction: row;
}
.pied {
bottom: 100px;
width: 90vw;
height: 30vh;
margin-left: auto;
margin-right: auto;
}
.pied {
font-weight: bolder;
font-family: serif;
position: absolute;
width: 0px;
overflow: visible;
bottom: 35%;
left: 50%;
}
.pied h1 {
position: absolute;
text-align: center;
text-transform: uppercase;
font-size: 16rem;
transform: translate(-50%, 0);
font-family: 'playfair_displayitalic';
top: 0;
left: 50%;
}
<main class="container">
<div class="central">
<div class="left">
<img src="images/chantal.jpg" alt="" class="belle">
</div>
<div class="right">
<section>
<header>
<h1> <span>strategy</span> </h1>
</header>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
</div>
</div>
<div class="pied"><h1>lucette</h1></div>
</main>
Mind the fact that you might need to tweak the bottom attribute of .pied as I did not have that font.
Main issue in your code was that you didn't set position: absolute for the main container of the text. I did some tweaks to ensure that text is also centered etc.
Using absolute position removes items from the normal flow of the page, and can often lead to isolation and z-index mistakes.
I'm attaching a method using a grid layout to superimpose items. Grids are usually easier to debug.
Just to be clear absolute positions can be used, this is just an alternative.
section {
display: grid;
}
.behind {
height: 5rem;
width: 5rem;
background-color: red;
grid-area: 1 / 1;
}
.front {
height: 3rem;
width: 3rem;
background-color: blue;
/* Can also use grid-area */
grid-column: 1;
grid-row: 1;
}
<section>
<div class="behind"></div>
<div class="front"></div>
</section>
enter image description here
Now the result is better but the problem now i want move the bloc center ho contain the picture and the texte in the the middle on the page but i can 't

Upscaling Image on Hover

I want to upscale image on hover, but the problem is I can make it overlapse its own container with overflow: hidden only by making img absolute positioned, wherefore all article content 'thinks' that there is no image in container.
article {
background: #e8e8e8;
color: #484848;
overflow: hidden;
padding: 0.5rem;
margin: 2rem auto 0 auto;
width: 60vw;
}
section {
float: left;
margin-right: 0.5rem;
}
p {
margin: 0;
}
img {
transition: 0.2s linear;
object-fit: cover;
width: 128px;
height: 128px;
}
img:hover {
position: absolute;
transform: scale( 1.5 );
}
<article>
<section>
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
</section>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</article>
How to freeze all article content after img becomes absolute positioned?
Please, no JS solutions.
float:left on p done the work!.
article {
background: #e8e8e8;
color: #484848;
overflow: hidden;
padding: 0.5rem;
margin: 2rem auto 0 auto;
width: 60vw;
}
section {
float: left;
margin-right: 0.5rem;
}
p {
margin: 0;
float:left;
}
img {
transition: 0.2s linear;
object-fit: cover;
width: 128px;
height: 128px;
}
img:hover {
position: absolute;
transform: scale( 1.5 );
}
<article>
<section>
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
</section>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</article>
As you want p to don't interact with images then before hover text will also don't interact with image and don't change it's own position.
The trick is to put the element you want to animate into a container, and then trigger the animation when you hover the container.
article {
background: #e8e8e8;
color: #484848;
padding: 0.5rem;
margin: 2rem auto 0 auto;
width: 60vw;
}
section {
float: left;
margin-right: 0.5rem;
}
p {
margin: 0;
}
img {
transition: 0.2s linear;
object-fit: cover;
width: 128px;
height: 128px;
}
.image-container {
display: inline-block;
}
.image-container:hover > img {
transform: scale( 1.5 );
}
<article>
<section>
<div class="image-container">
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
</div>
<div class="image-container">
<img src=https://image.freepik.com/free-vector/repeating-geometrical-square-background-pattern-vector-graphic-design-from-random-rotated-squares-with-opacity-effect_1164-1119.jpg>
</div>
</section>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</article>

Is it possible to have an element with absolute position to be 'fixed' to the bottom of it's parent container, even when scrolling via CSS/CSS3?

A variation of this question has been asked many times, but I cannot seem to find any solution for this particular problem. I have a <div> container element with content that has a variable height depending on the elements inside of it. I want a section of the container to always appear at the bottom of the container div, even when the user scrolls the content, they should always see the section at the bottom of the container. I would prefer not to use position: fixed because that is relative to the browser size, not the div, and when I use position: absolute I can suffessfully get it on the bottom of my container div, but once I start scrolling, it does not act like a "fixed" element, and scrolls with the content.
Is this possible to achieve this with pure CSS?
Here is my current code:
html, body, .container {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
.header {
background-color: red;
flex: 0 0 auto;
padding: 1em;
}
.content {
flex: 1 1 auto;
overflow-y: auto;
position: relative;
}
.content > p {
margin: 1em;
}
.bottom-section {
background: skyblue;
bottom: 0;
height: 50px;
padding-top: 1em;
position: absolute;
width: 100%;
}
.footer {
background-color: red;
flex: 0 0 auto;
padding: .5em;
}
<div class="header">HEADER</div>
<div class="container">
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="bottom-section">STAYS ON BOTTOM OF CONTENT</div>
</div>
</div>
<div class="footer">FOOTER</div>
Thanks!
The easiest way to accomplish this is to keep the "fixed" element outside the scrolling element, and use positioning based on the container to overlay the fixed element atop the scrolling one.
The only changes here were to move .bottom-section outside of .content, and setting position:relative on .container:
html,
body,
.container {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
.container {
position: relative
}
.header {
background-color: red;
flex: 0 0 auto;
padding: 1em;
}
.content {
flex: 1 1 auto;
overflow-y: auto;
}
.content>p {
margin: 1em;
}
.bottom-section {
background: skyblue;
bottom: 0;
height: 50px;
padding-top: 1em;
position: absolute;
width: 100%;
}
.footer {
background-color: red;
flex: 0 0 auto;
padding: .5em;
}
<div class="header">HEADER</div>
<div class="container">
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="bottom-section">STAYS ON BOTTOM OF CONTENT</div>
</div>
<div class="footer">FOOTER</div>
This might help, change those two classes as in snippet bellow, comment overflow: hidden in html, body, .container.
.bottom-section {
background: skyblue;
bottom: 0;
height: 50px;
padding-top: 1em;
position: absolute;
width: 100%;
}
.footer {
background-color: red;
flex: 0 0 auto;
padding: .5em;
}
html, body, .container {
display: flex;
flex-direction: column;
height: 100%;
/* overflow: hidden;*/
}
.header {
background-color: red;
flex: 0 0 auto;
padding: 1em;
}
.content {
flex: 1 1 auto;
overflow-y: auto;
position: relative;
}
.content > p {
margin: 1em;
}
.bottom-section {
background: skyblue;
bottom: 33px;
height: 50px;
padding-top: 1em;
position: fixed;
z-index: 1;
width: 100%;
}
.footer {
background-color: red;
flex: 0 0 auto;
padding: .5em;
bottom: 0;
position: fixed;
width: 100%;
}
<div class="header">HEADER</div>
<div class="container">
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="bottom-section">STAYS ON BOTTOM OF CONTENT</div>
</div>
</div>
<div class="footer">FOOTER</div>

inline block elements are off position

Does any one know why my text keeps pushing my 1 block element down? When i remove the text, the block elements are perfectly inline with each other.
<div class="item-0" align="center">
<div class="row">
<div class="col-lg-12">
<div class="body-0">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div><!-- body-0 -->
<div class="image-0">
<img src="images/ios_android_devices2.png" class="img-responsive" alt="ios_android" id="ios_android">
</div><!-- image-0 -->
</div><!-- col12 -->
</div><!-- row -->
</div><!-- item-0 -->
CSS is as follows
.item-0 {
background-color: green;
}
.body-0{
display: inline-block;
background-color: red;
max-width: 100;
width: 400px;
height: 250px;
}
.image-0 {
display: inline-block;
height: 250px;
max-width: 100;
width: 300px;
background-color: #ccc;
}
Use vertical-align:top;:
.image-0 {
display: inline-block;
height: 250px;
max-width: 100;
width: 300px;
background-color: #ccc;
vertical-align:top;
}
.body-0{
display: inline-block;
background-color: red;
max-width: 100;
width: 400px;
height: 250px;
vertical-align:top;
}
Codepen
Use vertical-align:top to align the inline blocks with each other (note: use the "Full page" option in the demo to see the effect):
.item-0 {
background-color: green;
}
.body-0{
display: inline-block;
vertical-align:top;
background-color: red;
max-width: 100;
width: 400px;
height: 250px;
}
.image-0 {
display: inline-block;
vertical-align:top;
height: 250px;
max-width: 100;
width: 300px;
background-color: #ccc;
}
<div class="item-0" align="center">
<div class="row">
<div class="col-lg-12">
<div class="body-0">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div><!-- body-0 -->
<div class="image-0">
<img src="images/ios_android_devices2.png" class="img-responsive" alt="ios_android" id="ios_android">
</div><!-- image-0 -->
</div><!-- col12 -->
</div><!-- row -->
</div><!-- item-0 -->

Split Background Centered Content

I'm trying to do a full-width split background colour with a centered content area. However, the content does not line up and is always off when the screen is resized.
The max-width is 1200px of the centered content area, the parent divs are split 60%/40%. When you do the math it's 720px/480px and should match the above div.
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
padding: 0;
margin: 0;
}
.site-content {
clear: both;
max-width: 1200px;
margin: 0 auto;
padding: 32px 0;
position: relative;
}
.site-content,
.left_container >div,
.right_container>div {
border: 1px solid #000;
}
.left_container,
.right_container {
padding-bottom: 100%;
margin-bottom: -100%;
/*Fixes float height*/
}
.left_container >div,
.right_container>div {
position: relative;
}
.left_container {
float: left;
width: 60%;
background-color: #ced7db;
}
.left_container > div {
float: right;
max-width: 720px;
}
.right_container {
background-color: #999;
float: right;
width: 40%;
}
.right_container > div {
max-width: 480px;
}
<header>
<div class="site-content">
<h1>Heading<h2>
</div>
</header>
<div id="introduction" >
<div class="left_container">
<div>
<h2>Left</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<div class="right_container">
<div>
<h2>Right</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
The desired outcome of this would be to have the heading area and content area aligned on the left and right edge, while the backgrounds extend to the end of the browser. I have tried using the gradient background method, the percentage width is still thrown off.
I wasn't able to do exactly what I wanted So I settled for the parent background gradient method. Example here:
CSS: Set a background color which is 50% of the width of the window