Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Single price grid component using Grid, rem units, media queries

Kevin H. 150

@kevinx9000

Desktop design screenshot for the Single price grid component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


My feedback and difficulties mostly came from responsive design adjustments with Grid and rem units. Here's where I need feedback:

  • Use of CSS Grid; I did a mobile-first workflow, and didn't implement Grid until the larger breakpoints; seems like there may have been a better way to use this and write less CSS for the breakpoints
  • Use of rem units; mobile-first was fine, but then going to large screens made everything seem too small, so I made a lot of manual size adjustments in the breakpoints; again, feels like there would have been a better way to master rem (and maybe em) units so that the size adjustments happen automatically for breakpoints

Otherwise, I welcome feedback about any other observations. Thank you!

Community feedback

Vanza Setia 27,835

@vanzasetia

Posted

Hi, Kevin! 👋

My feedback for the two mentioned points:

  • You only need to use one media query to switch the card from the one-column layout to the grid layout. You do not need to define grid-template-rows: auto; on the .container. That is already the default behavior. After that, you do not need to define the grid-column: span 1; on the second and third grid items. Try removing them and see if there is any difference.
  • You do not need to adjust the font size for larger screen sizes. You do not need media queries for the font sizes. On all screen sizes, the font sizes are the same. So, you only need a media query to switch the card's layout.

People with large screen sizes will zoom in or increase the zoom level. So you do not need to worry about making adjustments for large screen sizes such as those above 1440px.

Here are a few suggestions for improvements:

  • No extra element: Use the <main> element as the .container instead of having another <div> element.
  • One max-width: You only need to specify one max-width for the .container. You should put the max-width as the base styling of the .container.
  • Do not use pixel unit for font sizes: Use rem or em instead of px for font sizes. Never use px unit. Relative units such as rem and em can adapt when the users change the browser's font size setting. Learn more — Why you should never use px to set font-size in CSS
  • Do not change the <html> or the :root font size: It can cause huge accessibility implications for those users with different font sizes or zoom requirements. Grace Snow explains the issue clearly—Should I change the default HTML font-size to 62.5%?—and Joshua Comeau also does not recommend that approach—The Surprising Truth About Pixels and Accessibility: should I use pixels or rems?.
  • Do not specify default styling: Remove font-size: 1rem from the <body> styling. It is already the default styling.

I hope this helps. Happy coding! 👍

Marked as helpful

0

Kevin H. 150

@kevinx9000

Posted

@vanzasetia Thank you for taking a look at my code, and for your feedback! I greatly appreciate it and will review it with your suggestions in mind.

1
Kevin H. 150

@kevinx9000

Posted

Cleaned up and updated code.

0
Vanza Setia 27,835

@vanzasetia

Posted

@kevinx9000

Good! 👍

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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