@riverCodes
Posted
Hi, I would suggest you to try doing this challenge with CSS Grid (it has grid in the title xD) This solution is fine too, and I used to use flexbox for everything as well, but recently I've become somewhat of a Grid fanboy haha.
I recently did this challenge myself and using Grid with one media query to shift the layout was a really effective and efficient approach.
-
Because, assuming you implement a mobile-first workflow (375px), the 3 blocks are the same width (height depends on content) so its really easy to make it by using grid of 1column, setting a max-width and boom you're done. You can measure the rough width of the blocks in the reference design using Greenshot. Set a padding on the body, and the blocks will automatically resize on smaller screens because of the max-width. All you have left to do is style the content inside the blocks. That's easy.
-
For the desktop design, simply make a 2x2 grid. Use grid-column and grid-row properties to fit the 2nd and 3rd blocks in the bottom row slots. Double the max-width on your 1st block and use the same properties to make it span 2 columns of the first row. And you're done! :D
If you're unfamiliar with the grid properties, i was too, but I'd say it's totally worth the effort of reading up about it. MDN webdocs are what I used, but I'm sure you can find some videos as well!
Just today, i discovered another feature of CSS Grid called subgrid and my mind is blown. (it is only supported by firefox at the moment but it should be supported browser wide by late 2022)
Marked as helpful
@Kratos012
Posted
@riverCodes Yeah, I was always using flexbox before. But now I'm trying to learn more about grid. I haven't touched my computer for almost a month now due to illness. I feel I have lost all the progress I was making. So, I got to start learning all over again. Anyways, I won't give up tho. But, I won't lie, it's really frustrating knowing I would have been far along now if I kept at it. Well, life always happens.
@riverCodes
Posted
@Kratos012 hope youre doing well now bro! Even i took like a 10 day vacation from coding and it stings a little but the only way forward is to continue learning!