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 - First project ever!

Garf228 90

@Garf228

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. Change .container to a <main>.

  • The image has meaning, so it must 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.io).

  • .attribution should be a <footer>, and its text must be wrapped in a <p>.

CSS:

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

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

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

  • On the card, remove box-sizing: border-box. This declaration should apply to all elements, hence you should always include the following at the top:

* {
  box-sizing: border-box;
}
  • Remove width: 100% - divs are a block element, meaning it takes up 100% of th ewidth by default.

  • Remove the margin on the card.

  • To center the card horizontally and vertically, use Flexbox on the body:

display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100svh;
  • max-width on the card must be in rem - around 20rem works well.

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

  • Since all of the text should be centered, you only need to set text-align: center on the body, and remove it elsewhere. The children will inherit the value.

  • It is common to add display: block on images.

Marked as helpful

1

Garf228 90

@Garf228

Posted

@Islandstone89 this is amazing feedback, thank you so much! I will go through later today and make these changes.

1

@Zareck521

Posted

Looks great. I had the same problem with my text. Seemed no matter what I did, I couldn't get it the right size or look. Someone commented to me to add padding to the text and that really did help but I still couldn't get it just right.

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