Design comparison
Solution retrospective
Hello! I have completed the QR Code Component. I would like to have a feedback regarding my creation :)
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hello there π. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
HTML π:
- Always avoid skipping heading levels; Always start from
<h1>
, followed by<h2>
, and so on up to <h6> (<h1>,<h2>,...,<h6>). Swap the<h3>
tag with<h2>
- The
<br>
tag is not a semantic element. If a screen reader user is reading the page, they will hear "line break", which breaks the flow of the content. Instead, use CSS properties likemargin
andpadding
to add vertical space between elements.
- Since this component involves scanning the QR code, the image is not a decoration, so it must have an
alt
attribute. Thealt
attribute should explain its purpose. e.g.QR code to frontendmentor.io
CSS π¨:
- Instead of using pixels in font-size, use relative units like
em
orrem
. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here π.
- Setting the width of the component with a percentage or a viewport unit will behave strangely on mobile devices or large screens. You should use a max-width of
320px
or20rem
to make sure that the component will have a maximum width of320px
on any device, also remove thewidth
property with a percentage value.
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful1@Median21Posted almost 2 years ago@MelvinAguilar Thank you so much for the very detailed feedback! I was able to gain extra knowledge and learn from my mistakes. π
1 - Always avoid skipping heading levels; Always start from
- @HassiaiPosted almost 2 years ago
replace the <h3> with <h1> to fix the accessibility issue.
There is no need to give the body a width value and margin value, the main a padding value and .container a margin value.
To center .container on the page, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body.
To center .container on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center .container on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
Give h1 and p a font-size 0.9375rem which is 15px. This challenge does not require a box-shadow.
Hope am helpful.
Well done for completing this challenge. HAPPY CODING
Marked as helpful1@Median21Posted almost 2 years ago@Hassiai Thank you very much for the great feedback! I was actually having a problem centering my container π , but your solution helped me out. Thank you also for the tips!
0
Please log in to post a comment
Log in with GitHubJoin 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