Submitted over 2 years ago
@traez's Single price grid component using HTML and CSS
@traez
Design comparison
SolutionDesign
Solution retrospective
What I learned:
- Neatest and most efficient code written thus far
- Use combined selector (chained selectors) instead of unnecessary Classes/Ids
- Adhered to best practice for h1-h6 heading semantics
Continued development [Would appreciate any answers to below 2 questions]
- Smarter way to make CSS Grid responsive dimensions (height and width) when switching between mobile and desktop (using media queries)?
- Changing text (format) when switching between CSS Grid mobile and desktop (using media queries)?
Community feedback
- @vanzasetiaPosted over 2 years ago
Hello, Trae Zeeofor! 👋
Regarding the CSS selector, I would argue that using a single class selector would be a better approach. I agree that
id
should be avoided but should be used instead. In this case, it might be possible to style all elements withoutid
or classes. But, when you start working on a larger project, it will start getting harder to select the element that you want.Regarding your questions,
- For responsiveness you have done a good job by using
min-width
media query and usingem
unit. But there are a couple of things that I'd to recommend.- Setting a
max-width
to the card and removing thewidth
and theheight
properties. The only thing that the card needs to be responsive is amax-width
to prevent it from filling the entire page. For the height, let elements inside it control it. - Setting only
grid-template-columns
. In this case, there's no need for rows since the element only spans through the column. Also,grid-template-columns: repeat(2, 1fr);
is enough.
- Setting a
- I would guess that "text-format" means the font styling like font size. I recommend simplifying it. There is a common font size like
1.2rem
. You can set it as thebody
's font size. This way, you can just update thebody
element and then most of the elements will follow it.
Hope this helps! 🙂
Marked as helpful0 - For responsiveness you have done a good job by using
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