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 using only HTML and CSS

P
Ian Parker 180

@i-prkr

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?

Proud of:

I think that it looks correct! It has been a while since putting styling and front end work into practice so I'm happy that it turned out ok.

Next time:

Next time I would try organising the CSS a bit better, likely using a different CSS framework.

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

Challenges:

It was only a very simple project so there wasn't much challenge apart from my memory failing with some things and needing to be reminded of how to properly use flex boxes and layouts.

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

I would like to know if my CSS could be written more elegantly, or in a particular way so as to scale better for larger projects.

I was also unsure if more should have been added for the desktop & mobile specs - both looked correct in chrome dev tools.

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

  • Do not use words as "picture" or "image" in the alt text, as screen readers announce that automatically. The alt text must also say where it leads(frontendmentor website).

  • Headings should always be in order, so you never start with a <h4>. Since this is a component heading, it should be a <h2>.

CSS:

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

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

  • Remove all widths and heights in px.

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

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

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

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

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

  • Whenever the left and right margins are identical, you can use the shorthand: padding-inline: 32px.

Marked as helpful

2

P
Ian Parker 180

@i-prkr

Posted

@Islandstone89 Amazing feedback, just the kind of CSS guidance I was hoping for. Thanks for reasoning and links - appreciate your time!

1

@MellTins

Posted

I think you did a great job!

I would just put a <footer> underneath with the <div> with your name and the name of the challenge in the <href> tags, just for consideration.

Marked as helpful

1

@Caiquedev123

Posted

parabens que continui assim

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