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

CSS QR Code Component

@AntonielAureliano

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


Challenge made using CSS.

Community feedback

P

@Islandstone89

Posted

Hey, good job on creating this card! Here are some tips to make it even better :)

HTML:

  • I would remove the divs, as you don't need them here.

  • The image must have alt text. This is essential for screen readers to understand the image. The alt text should be descriptive, and in this example, it also needs to say where it leads (frontendmentor.io).

  • Footer text needs to be wrapped in a <p>.

CSS:

  • Performance-wise, it's better to link fonts in the <head> of the HTML then using @import.

  • It's good practice to include a CSS Reset at the top.

  • max-width on the card should be in rem. Around 20rem works fine.

  • Font-size must never be in px. Use rem instead, as you have done on everything except for .attribution.

  • Since all of the text is centered, put text-align: center on the body, and remove it elsewhere. The result will be the same but with less code. It works because of inheritance - the children inherit the value from their ancestor, the body.

  • Remove margin: 150px auto on the card. A better way to center it horizontally and vertically, is to use either Grid or Flexbox, on its parent, which in this example is the body:

Grid:

display: grid;
place-content: center;
min-height: 100vh;

Flexbox:

display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;

Marked as helpful

1

@AntonielAureliano

Posted

@Islandstone89 Thank you very much for the tips. They really helped me with any doubts I had and will help me write leaner code. I'm grateful for your feedback.

1

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