html – Transform: translate (-50%, -50%) – Stack Overflow

The reason why transform: translate(-50%, -50%) is required is because you want the center of the element to line up with the center of its parent. In simple terms, it can be boiled down to translateX(-50%) translateY(-50%), which means: move me leftwards by 50% of my width, along the x-axis, and move me upwards by 50% of my height, along the y-axis This effectively moves the center of the …

https://stackoverflow.com/questions/46184458/transform-translate-50-50