Design comparison
SolutionDesign
Solution retrospective
It was difficult for me to place two div next to each other. I didn't know which one to use: grid or flex
Community feedback
- @realsalePosted over 2 years ago
Yo! Hector,
Both
flex
andgrid
can achieve the same layout.- in
flex
you can simply set the containersdisplay
property toflex
, and it will layout theflex-items
(children) side-by-side(horizontally), that is because offlex-direction: row
which is a default property value inflex
container. - while in
grid
you need to set the containersdisplay
property togrid
and also specify how many columns you want yourgrid
should have usinggrid-template-columns
, it can be also be used to specify the size(width) of the column.
Marked as helpful0 - in
- @cholis04Posted over 2 years ago
Hi Hector Brito, You did a good job!
Flex
can be used for alignment on one axis, horizontally or vertically. ButGrid
can do alignment on both, vertical and horizontal.And to improve accessibility you should wrap the main content with the
<main>
tag.Marked as helpful0 - @hectorjbdPosted over 2 years ago
It was difficult for me to place two div next to each other. I didn't know which one to use: grid or flex
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord