Design comparison
SolutionDesign
Solution retrospective
Yes, I think mine was more of a brute-force approach, so I would like to learn more optimized CSS methods while dealing with responsiveness.
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hello π. Congratulation on successfully completing your first challenge π ! !
I have some recommendations regarding your code that I believe will be of great interest to you.
HTML π:
- Wrap the page's whole main content in the
<main>
tag.
CSS π¨:
- Do not use
overflow: hidden
on the body element, this will prevent scrolling on some devices.
- The
width: 100vw
property in thebody
tag is not necessary. Thebody
tag is a block element and it will take the full width of the page by default.
- Use
min-height: 100vh
instead ofheight: 100vh
. Theheight
property can cause your component to be cut off on small screens, such as a mobile phone in landscape mode.
- There is no need to use two selectors to center the component,
body, .container
, you can usebody
and completely remove the.container
tag. Then,justify-content: center;
is not necessary, by usingplace-items: center;
you will achieve centering it horizontally and vertically.
- Instead of using pixels in font-size, use relative units like
em
orrem
. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here π.
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful2@yagyesh-bobdePosted almost 2 years ago@MelvinAguilar Thank you so much for the suggestions. I have made the changes as you said.
0 - Wrap the page's whole main content in 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