@NimaFrEeMaN
Posted
Hi, you can center your elements by giving your element these properties
{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
Marked as helpful
@moheb2000
Posted
@NimaFrEeMaN Really thanks.
I have some problems with centering elements on screen. I know how I can center an element with flexbox but in small screens, I see some weird results. Thanks!
@NimaFrEeMaN
Posted
Hi, you can center your elements by giving your element these properties
{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
Marked as helpful
@moheb2000
Posted
@NimaFrEeMaN Really thanks.
Account Deleted
you can center the element by giving the body these properties display:flex; justify-content:center; align-items:center; height:100vh;
don't forget to mark this as helpful !
Marked as helpful
@moheb2000
Posted
@Old1337 Thanks! I used this method before and in small screens my card became very small. I think for small screens I should use media queries anyway.
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