JSFiddle - React, Tailwind, and code Playground
by Patrick Ludewig
HTML
<div class="container">
<div class="image">1 Image</div>
<div class="headline">2 Headline</div>
<div class="subheadline">3 Subheadline</div>
<div class="checkmarks">4 Checkmarks</div>
<div class="more">more content here in the right column</div>
</div>
SCSS
div {
padding: 20px;
}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: space-between;
@media (min-width: 700px) {
flex-direction: row;
position: relative;
}
&.grid {
display: grid;
grid-auto-columns: 1fr 1fr;
grid-auto-rows: 1fr auto;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
gap: 0px 0px;
grid-template-areas:
"Image Headline"
"Image Subheadlline"
"Image Checkmarks";
}
}
.image {
order: 0;
background: yellow;
flex: 0 1 100%;
@media (min-width: 700px) {
order: 1;
background: green;
flex-basis: 40%;
position:absolute;
top: 0;
left: 0;
right: 50%;
}
.grid & {
grid-area: Image;
}
}
.headline {
order: -1;
flex: 0 1 100%;
background: gainsboro;
@media (min-width: 700px) {
order: 2;
background: green;
position: relative;
left: 50%;
width: 50%;
}
.grid & {
grid-area: Headline;
}
}
.subheadline {
background: red;
order: -1;
flex: 0 1 100%;
@media (min-width: 700px) {
order: 2;
background: green;
position: relative;
left: 50%;
width: 50%;
}
.grid & {
grid-area: Subheadlline;
}
}
.checkmarks {
order: 0;
background: silver;
flex: 0 1 100%;
@media (min-width: 700px) {
order: 2;
background: green;
position: relative;
left: 50%;
width: 50%;
}
.grid & {
grid-area: Checkmarks;
}
}
.more {
background: #f1f1f1;
@media (min-width: 700px) {
position: relative;
left: 50%;
width: 50%;
order:99;
}
}