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

HTML & CSS solution for QR-code

valkre 30

@vallkre

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


What are you most proud of, and what would you do differently next time?

Proud that I managed to complete it but I hope to do better next time.

What challenges did you encounter, and how did you overcome them?

I didn't consider the height of the element and thus everything was stuck to the top, but a few minutes re-checking things made it clear.

What specific areas of your project would you like help with?

Not sure at the moment.

Community feedback

P

@Islandstone89

Posted

Hello, good job!

Here are some suggestions I hope you find helpful!

HTML:

  • The alt text must also say where it leads(frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website."

  • Do not use <br> to force text onto a new line. The text should flow naturally, and all styling, including space between elements, should be done in the CSS.

CSS:

  • Including a CSS Reset at the top is good practice.

  • I like to add 1rem of padding on the body, to ensure the card doesn't touch the edges on small screens.

  • Remember to specify a fallback font:font-family: 'Outfit', sans-serif;.

  • Fonts, and other typographic properties, get inherited by the children of the element you put it on. Place it on the body, and remove it elsewhere.

  • On the main, change height to min-height - this way, the content will not get cut off if it grows beneath the viewport.

  • Remove ALL widths in px. We want our components to be able to adapt to all kinds of screens, hence setting fixed sizes in px is not recommended.

  • Add a max-width of around 20rem on the card, to prevent it from getting too wide on larger screens.

  • Add flex-direction: column on the card.

  • Remove flex-wrap, it is not needed.

  • The padding should be equal on all sides of the card, so you can write it like this:padding: 20px.

  • I would use rem instead of em for font-size. And never use px, as that prevents the text from scaling if a user changes the default font size in the browser.

  • Paragraphs have a default value of font-weight: 400, so there is no need to declare it.

  • On the image, add display: block and max-width: 100% - the max-width prevents it from overflowing its container. Remove align-items and justify-content - these do not work without declaring display: flex, which you do not need here.

  • Remove align-content on .container, it is not needed.

  • As the design doesn't change, there is no need for any media queries. When you do need them, they should be in rem, not px. Also, it is common practice to do mobile styles first and use media queries for larger screens.

Marked as helpful

0

valkre 30

@vallkre

Posted

@Islandstone89 Thank you so much for the suggestions! I've read through them a few times and definitely learned and realized a lot of things that I hadn't considered before especially everything about units and how using px and other absolute units is not the best. Will try and implement them in the future challenges/projects I undertake. Thank you once again!

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