HTML, CSS and i used Flexbox to center the card
Design comparison
Solution retrospective
This is the first time i try to copy something as accurate as possible. Any feedback would be most welcome!
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
COMPONENT MEASUREMENTS 📐:
- The
width: 100vw
property forsection
element is not necessary. because it's a block level element which will take the full width of the page by default.
- Use
min-height: 100vh
forsection
instead ofheight: 100vh
. Setting theheight: 100vh
may result in the component being cut off on smaller screens.
- For example; if we set
height: 100vh
then thesection
will have100vh
height no matter what. Even if the content spans more than100vh
of viewport.
- But if we set
min-height: 100vh
then thesection
will start at100vh
, if the content pushes thesection
beyond100vh
it will continue growing. However if you have content that takes less than100vh
it will still take100vh
in space.
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful2@thomasmestdaghPosted over 1 year ago@0xAbdulKhalid Hey, thanks for the detailed feedback, it really helps!
0 - @NandiniCooppenPosted over 1 year ago
Hello thomasmestdagh,
Congrats on completing the QR- code challenge 👏
Here are some improvements that I would like to suggest :
improve accessibility
1. Alternative text
Adding a more meaningful description to the 'alt'.
For example alt="QR code for Frontend Mentor website"
2. Semantic structure
I have noticed that you have used the semantic HTML5 tag "section" in your structure. However to improve the document structure and in return improve its accessibility, consider using <header>, <main>, <article>, and <footer> elements where applicable.
3. Headings Instead of the <p> tag for the title, consider using the <h1> tag to provide a descriptive title.
For example :
<main> <section class="card-section"> <div class="card"> <img class="card-img" src="images/image-qr-code.png" alt="QR code for Frontend Mentor website"> <div class="card-content"> <h1 class="card-title">Improve your front-end skills by building projects</h1> <p class="card-text">Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p> </div> </div> </section> </main>
Read more about accessibility here
Read more about semantics here
Using CSS variables
For example, using the style guide provided, you may create your CSS colors variables as follow :
root { --white: hsl(0, 0%, 100%); --light-gray: hsl(212, 45%, 89%); }
Read more about CSS custom properties here
Using min-height
From .card-section remove width: 100vw and height: 100vh.
Add min-height:100vh;
.card-section {min-height:100vh;}
Read more about min-height here
Fix box shadow
I notice that your rgba value is not okay for your box-shadow. You have a value in excess.
box-shadow: 0 0 30px 0 rgba(0,0,0,0.0.2);
It should be like this :
.card { box-shadow: 0 0 30px 0 rgba(0,0,0,0.2); }
Read more about box-shadow here
Remove space on line 19 in your style.css file
I noticed there's a space between background-color: hsl(212, 45%, 89%); and display flex; for .card-section
I hope these will be helpful to you 😉
Good luck going forward and happy coding 🙂
Marked as helpful0@thomasmestdaghPosted over 1 year ago@NandiniCooppen Hey, thanks for the detailed feedback, it really helps!
1
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