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

the Frontend Mentor | QR code component website

@dev-gideon

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 a page's "main" section. Change the first <div> into 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). A good alt text would be "QR code leading to the Frontend Mentor website."

  • I would change the heading to a <h2> - a page should only have one <h1>, reserved for the main heading. As this is a card heading, it would likely not be the main heading on a page with several components.

CSS:

  • It is best practice to write CSS in a separate file, often called style.css. Create one in the same folder as the index.html, and link to it in the <head>: <link rel="stylesheet" href="style.css">.

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

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

  • Move font-family from* to body.

  • I would move the styles on .flexbox to the body - the <main> does not need any styles. Also, change height to min-height - this way, the content will not get cut off if it grows beneath the viewport.

  • Remove the width in px on the card. We rarely want to give a component a fixed size, as we want it to grow and shrink according to the screen size.

  • We do want to limit the width of the card, so it doesn't get too wide on larger screens. Give the card a max-width of around 20rem to solve this issue.

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

  • Remove font-weight and text-align from <p>, you don't need to declare neither of them. Paragraphs have a default value of font-weight: 400, so there is no need to set it explicitly. text-align is a property that gets passed down to its children. This means that if you set text-align: center on the card, all of the card content will inherit the value from their parent.

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

  • On the image, add display: block and change width to max-width: 100% - the max-width prevents it from overflowing its container. Without this, an image would overflow if its intrinsic size is wider than the container. max-width: 100% makes the image shrink to fit inside its container. Remove the margin.

Marked as helpful

0

@dev-gideon

Posted

@Islandstone89 Thanks

1

@yahappylemon

Posted

I'm not familiar with Grid so I'm afraid I can't give too much feedback on that part, but the rest seems amazing!Well-done!!

This is a peer review required by the challenge.

0

@dev-gideon

Posted

@yahappylemon i can give you a video about Grid

0

@yahappylemon

Posted

@dev-gideon Really? That would be helpful!

0

@dev-gideon

Posted

@yahappylemon your discord username

0

@yahappylemon

Posted

@dev-gideon Sorry, I'm not on discord. But still thanks!!

0

@dev-gideon

Posted

@yahappylemon Youtube-link: https://youtu.be/rg7Fvvl3taU?si=nVnANR1OsTegAjBE https://youtu.be/3T0gjtXRNC0?si=PK3-oaFpb9fHXnq9 https://youtu.be/0xMQfnTU6oo?si=0uEcxvkMhY0Bep8W https://youtu.be/EiNiSFIPIQE?si=ph7bwYZbx0vzDdvI

0

@yahappylemon

Posted

@dev-gideon Thank you so much!!!

Marked as helpful

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