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

HTML5, CSS, Flexbox

@polinagusakova

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. Wrap the card in a <main>.

  • You don't need to wrap every element in the card in a <div>.

  • The alt text must also say where it leads(frontendmentor website). Do not include words like "image" or "photo", as screen readers automatically announce it as an image. A good alt text would be "QR code leading to the Frontend Mentor website."

  • .attribution should be a <footer>, and you should use <p> for the text inside.

CSS:

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

  • Use the style guide to find the correct background-color.

  • Remember to specify a fallback font:font-family: 'Outfit', sans-serif;.

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

  • On the card, remove position, transform, max-width, max-height and overflow.

  • To center the card horizontally and vertically, with some space between the main and the footer, I would use Flexbox on the body:

display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100svh;
gap: 2rem;
  • Remove all widths and heights in px. Setting a fixed size is the number one reason for responsive issues.

  • 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. I would use em.

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

  • Remove font-family on the heading. When you set it on body, its descendants inherit the font.

  • 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 max-width: 100% - the max-width prevents it from overflowing its container. Remove the margin and the height.

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