QR Code Component using CSS Grid, Flex and Media queries
Design comparison
Solution retrospective
I tried building this QR component but had trouble getting it perfectly responsive across all screens. I ended up using media queries, alongside clamp, but is there a better way I could have done this? I feel as though I am using clamp incorrectly. Any other feedback is of course greatly appreciated.
Community feedback
- @darrowvPosted almost 2 years ago
Assalamu aleykum,
There is no reason to use clamp in this challenge. Just use width: 100% on img. Remove width and height from your main tag. And remove this
img { max-width: calc(600px - 45px); }
Things such as fixed width and height are mainly just going against responsiveness.
Marked as helpful1@developerabzPosted almost 2 years ago@darrowv Walaykum Assalam!
Jazak Allahu Khairun, this really simplifies things. I did not know I could just set the width to 100%. I will be using this from now on haha.
1 - @amalkarimPosted almost 2 years ago
Hi Abdullah,
It's interesting. I didn't know that css
clamp
exists! It's surely nice to know that. Thanks.Your solution is already great. Let me give you two suggestions only:
- Remove
height: 70vh;
frommain
, as that could ruin the card design when the browser height is less than the card's height.. - Give
padding: 20px;
or whatever pixel you prefer to thebody
to make the page nicer.
Hope this helps. Happy coding!
Marked as helpful1@developerabzPosted almost 2 years ago@amalkarim Hi Amal, This really fixed the height problem I was having on some devices. Thank you so much!
0 - Remove
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