Design comparison
Solution retrospective
When I was trying to center the div, with (display: flex, align-items: center, & justify-content: center) . It wasn't moving center of screen but was centering on top of the screen. Any ideas on why it was doing this? I had to use position which I don't think was the "proper" way of doing this.
Thanks! :)
- Tyler
Community feedback
- @denieldenPosted almost 2 years ago
Hello Tyler, You have done a good work! š
Some little tips to improve your code:
- add
main
tag and wrap the card for improve the Accessibility - also you can use
article
tag instead of a simplediv
to the container card for improve the Accessibility - instead of using
px
use relative units of measurement likerem
-> read here
Keep learning how to code with your amazing solutions to challenges.
Hope this help š and Happy coding!
Marked as helpful1@Tyler430Posted almost 2 years ago@denielden Would mind explaining the Accessibility? And would you use
px
for positioning andrem
for sizing?Thanks!
- Tyler
1@denieldenPosted almost 2 years ago@Tyler430 You are welcome and keep it up :)
For a full explanation of accessibility read here
I use
rem
everywhere0 - add
- @mishael-codesPosted almost 2 years ago
Hello Tyler
You have done well in your code
However, to address the complaint you made, rather that use the position property, try this...
body{ display: flex; align-items: center; justify-content: center; min-height: 100vh; }
The above code snippet makes the minimum body-height exactly the height of the screen viewport
min-height:100vh
. Therefore, centering the container in the middle of the page.For more explanation on the vh unit, check
ā¢ w3schools
Marked as helpful1
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