Design comparison
Solution retrospective
Welcome any advices Thanks~
Community feedback
- @danielmrz-devPosted 9 months ago
Hello @a1031748!
Your project looks great!
I have one suggestion for you to improve it even more:
- Using
position: absolute
is not the best option to center an element. It can cause bugs and may result in part of the contenet being cut off on smaller screens.
Here's a very efficient (and better) way to place an element in the middle of the page both vertically and horizontally:
š Apply this to the body (in order to work properly, don't use position or margins):
body { min-height: 100vh; display: flex; /* it works with grid too */ justify-content: center; align-items: center; }
I hope it helps!
Other than that, great job!
Marked as helpful0 - Using
- @sefaonderPosted 9 months ago
Hello @a1031748 Thank you for sharing your solution with us.
You did a nice job and I liked it.I just want to mention a few small details:
1.When using colors, you used the colors given in the design. This is very nice, but instead of using colors one by one, you can define them in the
:root
selector and use them everywhere in the project withvar()
. For more :root2.You used absolute and margin:auto to center the card. This is a solution, but in this case, you must define all dimensions of the card. This is not a very practical application, especially for different device sizes. You can use flexbox instead.For more flex-box
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