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

QR Code Component Using HTML and CSS

Lexsaโ€ข 100

@lexsac

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


This was my first Frontend Mentor challenge as well as first time using a Figma file as a point of reference for my code.

A couple of questions I have:

  • Was I too reliant on px as units of measurement vs. coding for responsiveness?
  • I was a bit unsure of centering using CSS grid (layout is still very tricky for me) - any suggestions for improving my code?

Community feedback

@MelvinAguilar

Posted

Hello there ๐Ÿ‘‹. Congratulations on completing your first challenge! You have done a great job and I can see you are on the right track.

I have some suggestions about your code that might interest you.

HTML ๐Ÿ“„:

  • Use the <main> tag to wrap all the main content of the page instead of the <div class="card"> tag. With this semantic element you can improve the accessibility of your page.
  • Use the <footer> tag to wrap the footer of the page instead of the <div class="attribution">. The <footer> element contains information about the author of the page, the copyright, and other legal information.
  • You must use a level-one heading (h1) even though this is not a full-page challenge. You can create an '<h1>' element within your 'main' element that will be hidden visually but visible and readable by screen readers. The class "sr-only" hides content visually and here are the styles to copy. e.g.: <h1 class="sr-only">QR Card Component</h1>

Alt text ๐Ÿ“ท:

  • The alt attribute should explain the purpose of the image. Uppon scanning the QR code, the user will be redirected to the frontendmentor.io website, so a better alt attribute would be QR code to frontendmentor.io

    If you want to learn more about the alt attribute, you can read this article. ๐Ÿ“˜.

CSS ๐ŸŽจ:

  • If you want to remove the space between the component and the footer, you should use "place-content: center;" instead of "place-items: center".
  • Instead of using pixels in font-size, use relative units like em or rem. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here ๐Ÿ“˜.

I hope you find it useful! ๐Ÿ˜„ Above all, the solution you submitted is great!

Happy coding!

Marked as helpful

1

Lexsaโ€ข 100

@lexsac

Posted

@MelvinAguilar thank you so much for the feedback - much appreciated!

1
Hassia Issahโ€ข 50,810

@Hassiai

Posted

Replace<div class="card">with the main tag, <h2> with <h1> and <div class="attribution"> with the footer tag to fix the accessibility issues. click here for more on web-accessibility and semantic html

to center .card on the page using grid, replace the height in .container with min-height: 100vh.

Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

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