Design comparison
Solution retrospective
Hello! This is my first ever challenge after learning HTML and CSS for a couple of weeks. I feel like I understand the visual aspects of the page. But in terms of positioning the container in the body and making it responsive based on device was something I'm unsure about.
I used Atom for my coding program and while I was making it I thought I had the position right, but after uploading to Github the qr component was in a totally different place.
I'd love how to the best practices for responsive designs!
Thank you!
Community feedback
- @rachit0706Posted about 2 years ago
Congratulations for completing your first challenge!! There are few suggestions for improving your code:
- Wrap the whole content inside a main tag for better semantics.
- You can use flexbox with flex direction as column on your main tag to center the qr component in the page. Here are some helpful resources: https://css-tricks.com/snippets/css/a-guide-to-flexbox/, https://www.w3schools.com/css/css3_flexbox.asp https://flexbox.tech/
- Using flexbox in the card will also fix your layout issue and then you will not need to set position attributes in the card.
- You can set font family in the body selector itself instead of repeatedly setting in sentence 1 and 2.
If you have any more doubts you can reply to this feedback.
Marked as helpful1@CandesuPosted about 2 years ago@rachit0706 Thank you so much!! I learned about flex-box but with your reminder it finally clicked.
0 - @correlucasPosted about 2 years ago
๐พHi Candace, 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:
- Fix the component responsiveness, its not working yet and this is due the
fixed width
you've applied to the container. The difference betweenwidth
andmax-width
is that the first(width) is fixed and the second(max-width) isflexible
and make the element shrink when the screen starts to scale down. So if you want a responsive block element, never usewidth
choose ormin-width
ormax-width
. - 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!
0 - Fix the component responsiveness, its not working yet and this is due the
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