I have checked these two posts: Adjacent divs with angled borders? [duplicate] and Shape with a slanted side (responsive) but those solutions posted do not adjust to 100% height of the container and I need this. I cannot find a solution to fit my scenario.
I'm trying to replicate this behaviour the difference is the text inside this container can be of any height so I need the angle and container to adapt to fit any height (not a fixed height container):
Here's the code I'm using with a jSFiddle: https://jsfiddle.net/qzma0r6k/1/
CSS
section {
position: relative;
color: #fff;
}
.diagonal:before {
position: absolute;
content:'';
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
top: 0;
right:0;
height:100%;
z-index: 0;
width: 50%;
background:pink;
}
HTML
<section class="c-1">
<div class="c-2 diagonal">
<h1>Work with us</h1>
<p>Scelerisque et parturient dis a erat cubilia congue sociosqu vel porta sem posuere a malesuada suspendisse id commodo. Dui consequat consectetur luctus odio nibh a vel sapien hendrerit ad a consectetur cursus a nisl posuere.</p>
</div>
<div class="bg-image"></div>
</section>