educative.io

Css transform: translate(-50%, -50%) for reinforcement of centering

Why do we need the css transform: translate(-50%, -50%) when we already have top: 50%, left 50%

Hi Ross!
We need translate(-50%, -50%) because we want the center of the element to line up with the center of its parent.
Hope it helps.