This is the layout I’m trying to achieve with CSS:
And this is the HTML structure I have and can’t touch at all, and what I’ve managed to add with CSS. It’s close but something is missing:
.container {
display: flex;
flex-wrap: wrap;
}
.item-1 {
flex: 50%;
}
.item-2 {
flex: 50%;
}
.item-3 {
flex: 100%;
}
<div class="container">
<div class="item-1">
This is an image
</div>
<div class="item-2">
This is a title
</div>
<div class="item-3">
Short desc goes here.
</div>
</div>
How do I fix this? Thank you!
>Solution :
In case you’re looking for a grid solution:
.container {
display: grid;
grid-template-columns: 1fr 1fr;
/*two equal width columns.*/
grid-template-rows: auto auto;
/* two rows with auto height. */
grid-gap: 10px;
}
.item-1 {
grid-row: 1 / 3;
}
.item-2 {
grid-row: 1 / 2;
}
.item-3 {
grid-row: 2 / 3;
grid-column: 2 / 3;
}
<div class="container">
<div class="item-1">
This is an image
</div>
<div class="item-2">
This is a title
</div>
<div class="item-3">
Short desc goes here.
</div>
</div>
