Qr code component using HTML and CSS
Design comparison
Solution retrospective
Itsmy first challenge on frontendmentor, any comment is welcomed.
Community feedback
- @denieldenPosted about 2 years ago
Hello Fico, You have done a good work! π
Some little tips to improve your code:
- use
main
tag to wrap the card and improve the Accessibility but not as a container of that one element - also you can use
article
tag instead of a simplediv
to the container card for improve the Accessibility - use
h1
for title of card and not a simplep
- remove all
margin
frommain
tag - use flexbox to the body to center the card. Read here -> best flex guide
- after, add
min-height: 100vh
to body because Flexbox aligns child items to the size of the parent container - instead of using
px
use relative units of measurement likerem
-> read here
Keep learning how to code with your amazing solutions to challenges.
Hope this help π and Happy coding!
Marked as helpful0 - use
- @correlucasPosted about 2 years ago
πΎHi @fico444, congratulations on your solution!
Great solution and a great start! From what I saw youβre on the right track. Iβve few suggestions for you that you can consider adding to your code:
To maintain the card responsive use
max-width
instead ofwidth
this way you allow the content to be flexible. The difference betweenmax-width
andwidth
is thatwidth
is fixed andmax-width
has a maximum size but can shrink to fit the content.Replace the
<p>
containing the main title with<h1>
note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading. Use the sequence h1 h2 h3 h4 h5 to show the hierarchy of your titles in the level of importance, never jump a level.Clean your code by removing some unnecessary divs, most of the content can stand alone without a div. Use div only for blocks that need a special alignment or the content needs a special positioning.
Add a margin of around
margin: 20px
to avoid the card touching the screen edges while it scales down.Use relative units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/qr-code-component-vanilla-cs-js-darklight-mode-nS2aOYYsJR
βοΈ I hope this helps you and happy coding!
Marked as helpful0 - @vanzasetiaPosted about 2 years ago
Hi there! π
Congratulations on completing your first Frontend Mentor challenge! π Good job on wrapping all the page content with the correct landmark elements! π`
Here are some suggestions for improvements.
- I recommend making the first paragraph a
h1
instead. For your information, each page needs oneh1
. You can think of theh1
as the title on the document. So, it is important to have it. - I recommend adding
rel="noopener"
to any anchor tags that havetarget="_blank"
. It helps protect users of legacy browsers. I suggest reading "Links to cross-origin destinations are unsafe" article to learn more about this. - To place the card in the center of the page, I recommend using flexbox or grid. You can use the
body
element as the container of the card element. This method will make sure the card is centered regardless of the user's screen size. - Use
rem
or sometimesem
unit instead ofpx
. Usingpx
will not allow the users to control the size of the page based on their needs. I recommend reading this article aboutrem
andem
unit. This article explains both units in a simple way.
That's it! I hope this helps! Happy coding! π
Marked as helpful0 - I recommend making the first paragraph a
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