Design comparison
Community feedback
- @Kamlesh0007Posted over 1 year ago
Hello there π. Good job on completing the challenge !
In general, the solution is excellent. I have 2 small suggestions:
CSS π¨:
Yes, there are other ways to center the card without using flex. One way is to use the grid layout: .container { display: grid; place-content: center; min-height: 100vh; } You can read more about centering in CSS here π. Noteβ οΈ: Use min-height: 100vh instead of height. Setting the height to 100vh may result in the component being cut off on smaller screens, such as a mobile phone in landscape orientation. Noteβ οΈ: You can also use position: relative, but using it in this type of component is a bad idea because it will clip it on mobile devices. CSS Reset π:
Currently, you have a vertical scrollbar, which is due to the default margin that some browsers apply to the body element. To remove it and avoid problems in future challenges, I recommend starting to use a CSS reset. A CSS reset is a set of CSS rules that are applied to a webpage in order to remove the default styling of different browsers. CSS resets that are widely used: "My Custom CSS Reset" by JoshWComeau Reset CSS I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful1@wilbrosPosted over 1 year agoThanks for the feedback. Its my first time hearing about CSS reset. I will definitely check it out. @Kamlesh0007
0 - @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: 100%
property formain
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
formain
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 themain
will have100vh
height no matter what. Even if the content spans more than100vh
of viewport.
- But if we set
min-height: 100vh
then themain
will start at100vh
, if the content pushes themain
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 helpful0
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