@Bader-Idris
Posted
You can set the container in the middle of the screen whatever user changes it when you add these properties to it in CSS:
.container {
display: absolute;
top:50%;
left: 50%;
transform: translate(-50%, -50%);
}
the new feature is transform, it has many lovely properties you can discover, I personally love it. Hope it's useful
Marked as helpful
@danyelvarejao
Posted
@Bader-Idris
Do you think this is better than display: flex
, justify-content: center
, align-items: center
?
On what occasion would I use the way you said? I couldn't understand well
Thanks for review.
@Bader-Idris
Posted
@danyelvarejao you can use it when you add some tricky elements vertically as tranformX() or horizontally as transformY, when having a parent element and its children, the one child, the better
Marked as helpful
@danyelvarejao
Posted
@Bader-Idris
Got it, thanks for the tip. 😊