Design comparison
Solution retrospective
I have more questions than anything.
What is best practice for overall layout? I've seen some solutions to this where they used flexbox on the header then used grid for the middle cards. I used margin auto on the header. Is it best to use flexbox?
Should you always use relative units for responsive design in every aspect (e.g., margins, padding, font size, etc.)? Someone cleverly used margin-block to center the outer cards in the grid area, I had to calculate the middle height then span across those rows to get the same effect. I didn't realize you could vertically center with margin-block. Is this common practice?
I'm confused when one should set definite sizes on height and width for a container. For example for the cards, I guess this is just determined by the rows/cols of the grid rather than explicitly setting the height/width. Is it best to just use max-width? What about height? Should one use something like min-height ever?
Community feedback
- @VCaramesPosted about 2 years ago
Hey there! 👋 Here are some suggestions to help improve your code:
Regarding your questions,
-
There is not a "perfect" to build any challenge. There is only the "modern" way. So Flex and CSS Grid is the way to go. But ideally CSS Grid; since it is the more advance version of Flex. I wouldn't use "margin auto"; use one of the above.
-
For
font-size
and media-queries **absolutely. Everything else, for now, can be px. -
You will rarely need to se definite sizes. I have yet to do one for any of these challenges. For the cards, you can give them a
min-height
andmax-width
to match the FEM design. (Always usemin-height
)
Here is how I did my challenge:
https://www.frontendmentor.io/solutions/four-card-layout-mobile-first-css-grid-E06SgjxBJG
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! 🍂🦃
Marked as helpful0 -
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