Design comparison
Solution retrospective
I am having fun solving these challenges. Please review my code and tell me how can i improve my code. How can I optimize my code is there any other efficient method please let me know.
I am waiting for yours feedbacks.
Community feedback
- @correlucasPosted about 2 years ago
👾Hi @AasishSapkota, congratulations on your solution!👋 Welcome to the Frontend Mentor Coding Community!
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:
- Save your time using a CSS RESET to remove all default settings that are annoying as the margins, paddings, and decorations and optimize it making it easier to work, see the article below where you can copy and paste this CSS code cheatsheet: https://piccalil.li/blog/a-modern-css-reset/
- Use
<main>
instead of a simple<div>
this way you improve the semantics and accessibility showing which is the main block of content on this page. Remember that every page should have a<main>
block and that<div>
doesn't have any semantic meaning. - Replace the
<h2>
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. - The box-shadow is a bit too strong, this is due the
opacity
andblur
. The secret to create a perfect and smooth shadow is to have low values foropacity
and increaseblur
try this value instead:box-shadow: 12px 7px 20px 6px rgb(57 75 84 / 8%);
. If you’re not familiar to box-shadow you can use this site to create the shadow design and then just drop the code into the CSS: https://html-css-js.com/css/generator/box-shadow/ - 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 helpful1 - @husamasaadPosted about 2 years ago
Hello my friend, you did a great job but the qr image isn't showing and here's how to fix that :
on your
<img class="qr-code" src="/images/image-qr-code.png" alt="image-qr-code">
see that / before images in your src ?
delete that!
then it will show just fine... you did a great job, keep going and have fun
Marked as helpful1 - @MelvinAguilarPosted about 2 years ago
Hi @AasishSapkota 👋, good job for completing this challenge!
Here are some suggestions you might consider:
- Update the image tag to:
<img class="qr-code" src="./images/image-qr-code.png" alt="image-qr-code">
- Try to use semantic tags in your code. More information here:
With semantic tags:
<body> <main class="container"> . . . </main> <footer class="attribution"> . . . </footer> <body>
- You could use a CSS Reset to remove browser built-in styles and reduce browser inconsistencies
Your body's default margin causes the vertical scrollbar to appear
Popular reset style sheets:
I hope those tips will help you.
Good Job and happy coding !
Marked as helpful1
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