My vision is clear:
https://i.sstatic.net/xi7KI.png
Flex is the way to go for this, but my attempts are falling short:
.content-wrapper,
.tablet-top,
.tablet-middle,
.tablet-bottom {
display: flex;
justify-content: center;
}
/*tablet*/
@media (min-width: 426px) and (max-width: 767px) {
.tablet-top,
.tablet-middle,
.tablet-bottom {
flex-direction: row;
}
.content-wrapper {
flex-direction: column;
}
}
/*mobile*/
@media (min-width: 0) and (max-width: 425px) {
.content-wrapper,
/* added */
.tablet-top,
.tablet-middle,
.tablet-bottom {
flex-direction: column;
align-items: center;
/* added */
}
}
<div class="content-wrapper">
<div class="tablet-top">
<div class="dog"><img src="https://i.imgur.com/RJdUaQ0.png" height="100" width="140"/>
<div class="cat"><img src="https://i.imgur.com/bHoUb1x.png" height="100" width="140"/>
</div>
<div class="tablet-middle">
<div class="mouse"><img src="https://i.imgur.com/IqUglWY.png" height="100" width="140"/>
<div class="snake"><img src="https://i.imgur.com/IHaFNSs.png" height="100" width="140"/>
</div>
<div class="tablet-bottom">
<div class="cow"><img src="https://i.imgur.com/JTFwdZT.png" height="100" width="140"/>
<div class="pig"><img
src="https://i.imgur.com/rzKcrup.png"
height="100" width="140"/>
</div>
</div>
Do we need an additional div in the HTML to show dog
, cat
, and mouse
in a single row on desktop?
Wouldn't doing so compromise responsiveness? Furthermore, my current code seems ineffective on Tablet - it should divide the tablet-top
, tablet-middle
, and tablet-bottom
divs into three distinct rows.