Design comparison
Solution retrospective
Hi. I find it difficult to center the whole div in different screens or even different browsers. I'm unsure about the CSS code, the order of the properties, I know it's really important. It works but I know it could be better, any kind of feedback it's useful.
Community feedback
- @msuryaditriputraRPosted over 2 years ago
Hi Julieta Perez π
Firstly, I wanna congrats you on your success finish this challenge π
However i have some feedbacks for u πΌ
Accessibility π
- Wrap all of your content with the
main
tag. All page content should be contained by landmarks. - For heading text use
h1
instead ofh3
if you just have one heading on your page. Page should contain a level-one heading. - Wrap
attribution div
withfooter
and place it at the bottom of your page for a better experience, or if you want to keep it at the top wrap it withheader
.
Code & Design π
- If you want to place your div at the center of the page with position property. You should use
transform: translateX(-50%)
when you set the left with 50% andtransform: translateY(-50%)
when you set the top with 50%. or you just need to usetransform: translate(-50%,-50%)
for shorthand. learn more about translate - For best practice and easy way to make content centered is use grid layouting β‘
main{ display: grid; place-content: center; min-height: 100vh; }
and trada it's magic β . learn more about grid layouting.
I hope this helps, keep it up your good work and Happy Coding β
Marked as helpful0 - Wrap all of your content with the
- @bvrklPosted over 2 years ago
Get familiar with flex box in CSS.
It helps with centering, but has a lot of other functionality to make your sites much more responsive to the screen sizes etc.
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