QR Code Component design using flexbox and using viewport height
Design comparison
Solution retrospective
Please tell me everything that is all wrong in my way of coding.
What is the best way to center div?
Do you have any tips in about best practices?
Community feedback
- @vanzasetiaPosted over 2 years ago
Hello Urinzi! 👋
Congratulations on completing this challenge! 🎉
In this case, the best way to center the card element is to make the
body
element as either grid or flexbox container. So, I would recommend removing the flex properties from the card element. After that, addplace-items: center
and usemin-height
instead ofheight
property.place-items: center
is equal tojustify-content: center
andalign-items: center
. I recommend usingmin-height
because it will make sure that thebody
element would allow to grow if ever needed.Some best practices.
figure
element doesn't need to wrap theimg
element. The only reason to usefigure
is if you need to include afigcaption
. Otherwiseimg
tag is fine.- Use single class selectors for styling whenever possible instead of
id
.id
has high specificity which can lead to a lot of issues on the larger project. It's best to keep the CSS specificity as low and flat as possible. 😉
I hope this helps!
Marked as helpful0@jc-paduaPosted over 2 years ago@vanzasetia Thank you so much! It would be very helpful in improving my responsive designs and the proper use of elements in HTML. I'm grateful to have advice from an expert like you. Thank you so much! It motivates me a lot!
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