Witam. Już od dłuższego czasu męczę się z kodem. Potrzebuję zrobić taki box z news jak na załączonym obrazku.
Mam kod z 2 kolumnami ale nie mogę ogarnąć ustawienia 3 kolumny. Męczę się z tym dłuższy czas i nie wiem o co chodzi :(
<div class="section">
<div class="card one">
<div class="card-info">
<h1>1</h1>
</div>
</div>
<div class="card two">
<div class="card-info">
<h1>2</h1>
</div>
</div>
<div class="card three">
<div class="card-info">
<h1>3</h1>
</div>
</div>
<div class="card four">
<div class="card-info">
<h1>4</h1>
</div>
</div>
<div class="card five">
<div class="card-info">
<h1>5</h1>
</div>
</div>
</div>
.section {
display: flex;
flex-direction: column;
align-items: center;
}
.section .card {
padding: 0;
margin: 0.5em 0;
background-image: url(https://picsum.photos/800);
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;
display: flex;
flex-direction: column;
justify-content: flex-end;
width: 85vw;
height: 300px;
}
.section .card .card-info {
background: rgba(0, 0, 0, 0.75);
color: #f1f1f1;
}
.section .card .card-info h1 {
margin: 0;
padding-top: 1em;
color: inherit;
}
@media screen and (min-width: 768px) {
.section {
all: unset;
display: grid;
width: 90vw;
max-width: 1200px;
margin: 0 auto;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
justify-content: center;
grid-gap: 1em;
grid-template-areas: "head1 head2""head1 head5";
}
.section .card {
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
width: 100%;
}
.section .one {
grid-area: head1;
height: 100%;
}
.section .two {
grid-area: head2;
}
.section .three {
grid-area: head3;
}
.section .four {
grid-area: head4;
}
.section .five {
grid-area: head5;
}
.stories-wrapper {
flex-direction: row;
margin: 0 auto;
}
.stories-wrapper .story-card {
flex-direction: row;
}
.stories-wrapper .story-card img {
max-width: 200px;
}
}
Załączam też odnośnik do codepen https://codepen.io/wixser/pen/mdRpBaa
Z góry bardzo dziękuję za porady i nakierowanie na odpowiednie tory :)