JSFiddle - React, Tailwind, and code Playground
HTML
<div class="block">
<div class="card blue">
<h1>1000s of Website & Block Templates</h1>
<p class="text">Customize anything on your website with simple dragging.</p>
</div>
<div class="card red">
<h1>HTML CSS</h1>
<p class="text">Select from a huge variety of designer-made templates.</p>
</div>
<div class="card gray">
<h1>No Coding</h1>
<p class="text">Visually add, edit, move, and modify with no coding!</p>
</div>
<div class="card orange">
<h1>Mobile-Friendly</h1>
<p class="text">Build websites that look great on all modern devices.</p>
</div>
</div>
CSS
:root {}
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 50px;
font-family: arial, sans-serif;
}
.block {
display: grid;
grid-template-columns: repeat(4, 1fr);
column-gap: 20px;
margin: 0 auto;
}
.card {
--bg: #4184f4;
--x: 20px;
--mt: 20px;
--mb: 0px;
--mr: 20px;
--ml: 0px;
position: relative;
width: 280px;
min-height: 200px;
margin-top: calc(80px + var(--mt));
margin-bottom: var(--mb);
margin-left: var(--ml);
margin-right: var(--mr);
padding: 40px;
border: 1px solid #eee;
background: #fff;
box-shadow: 0 0 20px 0 rgba(34, 60, 80, 0.2);
text-align: center;
}
.card:nth-child(even) {
--mt: 0px;
--mb: 20px;
--ml: 20px;
--mr: 0px;
--x: -20px;
}
.card::before {
content: "";
position: absolute;
top: 0;
left: 0;
transform: translate(var(--x), -80px);
display: block;
width: 100%;
height: 247px;
background-color: var(--bg);
z-index: -1;
}
.card h1 {
margin: 0 20px 0;
line-height: 1.5;
font-size: 18px;
}
.blue {
--bg: #4184f4;
}
.gray {
--bg: #5cb85c;
}
.red {
--bg: #f15048;
}
.orange {
--bg: #fb9056;
}
.text {
color: grey;
font-size: 16px;
margin: 20px 0 0;
}
@media (max-width: 1280px) {
.block {
width: min-content;
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 760px) {
.block {
grid-template-columns: repeat(1, 1fr);
}
.card,
.card:nth-child(even) {
--x: 0px;
--mt: 20px;
--mb: 0px;
--mr: 0px;
--ml: 0px;
}
}