Design comparison
Community feedback
- @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.
CSS π¨:
- Looks like the component has been centered properly. But the issue is the content inside the
body
causes overflow on smaller screens and let people scroll the content, this issue want to be cleared
- Now set
margin
forbody
, after setting you can able to see the changes
body { margin: 0; }
- Now the overflow of content has been cleared
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0 - @pperdanaPosted over 1 year ago
Hi, Well done on completing the challenge! π
- I have other recommendation for your code to center an element both horizontally and vertically.
Using relative position
Since you use flexbox to center element both horizontally and vertically, you can also use relative positino to do it.
Set the position property of the child element to "absolute" and use the "top", "bottom", "left", and "right" properties to center the element both horizontally and vertically. For example:
.parent { position: relative; } .child { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); /* other styles for the child element */ }
I hope this information was beneficial for you! π
Happy codingπ€
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