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

@CarlosAlexandredevv

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

P

@Islandstone89

Posted

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 the "main" section of a page. Since the card is the only main content, you can change .container to a <main>.

  • 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).

  • Headings should always be in order, so you never start with a <h3>. Change it into a <h1>. "Improve your front-end skills by building projects" should be wrapped in one <h1>.

  • Similarly, the paragraph text only needs one <p>.

CSS:

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

  • Set the font-family on the body instead of *, that is common practice.

  • height on body must be min-height - this way, the content will not get cut off if it grows beneath the viewport.

  • font-size must never be in px. This is bad for accessibility, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead.

  • Remove width and margin on the image, and add display: block and max-width: 100% - the max-width prevents it from overflowing its container.

  • Remove height from the card - you should never set a height on elements containing text (and mostly not otherwise,too). On my laptop screen, the paragraph overflows the card, as the card content has grown taller than the card height.

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

  • To create the space between the image and the edge of the card, set padding on all 4 sides of the card.

  • 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.

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