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

#bem#sass/scss
Chris• 30

@ks-web-workbench

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?

This is the first time I'm publishing code anywhere :)

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

Im not sure if my html is semantically correct.

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

I really don't know how to control line of text. I used max-width: 25ch to limit lenght of text but I don't know if it is done right. Is h2 semantically appropriate for a component header?

Community feedback

P

@Islandstone89

Posted

Hi Chris, good job!

Here is what could be improved - I hope it helps :)

HTML:

  • Every webpage needs a <main> that wraps all of the content, except for <header> and footer>. This is vital for accessibility, as it helps screen readers identify a page's "main" section. Wrap the card in a <main>.

  • The qr code is meaningful content and should be placed as an <img>, not as a background-image. It also needs to have proper alt text. Write something short and descriptive, without including words like "image" or "photo". Screen readers start announcing images with "image", so an alt text of "image of qr code" would be read like this: "image, image of qr code". The alt text must also say where it leads(frontendmentor website).

  • It is OK to use <h2> for a component header. In a real-world scenario, several components would be on the same page. There can only be one <h1> on a page, so the headings on the components are more suited as <h2>.

CSS:

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

  • Add around 1rem of padding on the body, so the card doesn't touch the edges on small screens.

  • Remove the width on the card. You should rarely set fixed sizes, as components need to be able to adapt to all kinds of screens.

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

  • Remove all properties on the image, except for border-radius. Add display: block and max-width: 100% - the max-width prevents it from overflowing its container.

Marked as helpful

1

Chris• 30

@ks-web-workbench

Posted

@Islandstone89 Thank you for the comprehensive feedback. It was really helpful.

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