I hope this is not against rules. I want to ask. What is difference between
position: absolute;
top:50%;
left:50%;
and
transform: translate(-50%, -50%);
what is better to use in your opinion ?
I hope this is not against rules. I want to ask. What is difference between
position: absolute;
top:50%;
left:50%;
and
transform: translate(-50%, -50%);
what is better to use in your opinion ?
position: absolute;
top:50%;
left:50%;
This object is placed according to the parent element. It will change according the parent's position.
transform: translate(-50%, -50%);
This object is based on itself. If the object is moved, it will translate according its new position.
Although both can show the same result in initial format, you will notice clear differences when styling parent elements.