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-components (HTML+CSS)

Killer-85 40

@Killer-85

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?

I’m proud that I was able to complete this task simply and without any hassle. What I will do differently next time is thoroughly read the instructions instead of rushing to code, as this caused me to lose a lot of time

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

I really didn’t encounter any problems at all.

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

None

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

  • For the 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(the frontendmentor website). 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.

  • .attribution should be a <footer>, and you should use <p> for the text inside. The footer needs to be outside of the main, not inside it.

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 like to add 1rem of padding on the body, to ensure the card doesn't touch the edges on small screens.

  • Move background-color from html to body.

  • Move the properties on .container to body. You can remove the .container selector, as it doesn't need any styles. Change height to min-height - this way, the content will not get cut off if it grows beneath the viewport. Add flex-direction: column(makes the footer go under the main instead of beside it) and gap: 2rem;(creates space between the main and the footer).

  • Remove display: inline-block on the card, it is not needed.

  • Remove justify-content: center on the card - it doesn't work without first declaring display: flex;. However, this is not needed.

  • Remove all widths and heights in px - it is rarely smart to apply fixed sizes, as it prevents components from adapting to different devices.

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

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

  • letter-spacing must also never be in px. You can use em, where 1em equals the font size of the element.

  • On the image, add display: block and max-width: 100% - the max-width prevents it from overflowing its container. Remove the margin. If needed, you can add margin-bottom to separate it from the text.

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

  • I would use px instead of % on border-radius.

0
P
Jason Lee 10

@jason-sj-lee

Posted

Looks good! Placement of the card looks a little lower than the design but no actual issues. For the code, a separate CSS file might be better just for overall readability and keeping code modular.

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