I'm trying to create a layout as shown in the image here, where:
- I have a three column layout
- A div element is as wide as two columns
- In the div that is two columns wide is an image which i need to pull out to the left to the browser border, and the right side to the image to remain as wide as the two columns to it stays "stuck" to the right
I've used this code, and applied it to the image within the column, but do be honest I don't understand what it does:
margin-left: calc( -100vw/2 + 100%/2);
HTML
<div class="wrapper">
<div class="col-1"><img src="blabla" /></div>
<div class="col-2">Content</div>
</div>
CSS
.wrapper {
max-width: 1400px;
display: block;
margin: auto;
}
.col-1 {
float: left;
width:66.666%;
}
.col-2 {
float: left;
width: 33.333%;
}
.col-1 img {
display: block;
width: 100%;
height: auto;
margin-left: calc( -100vw/2 + 100%/2);
}
The result is it pulls out to the left browser edge but the right side of the image doesn't remain in place.
I don't understand what i need to do to achieve this layout, and maybe it's not even possible.