Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between transform:translate3d(50%,0,0) and left:50% in css?

Tags:

css

transform

How does the transform:translate3d(50%,0,0) differ from left:50% in css? heres the jsfiddle that i made.

transform: translate3d(50%,0,0)

and

left:50%;

figure

like image 462
Vivekraj K R Avatar asked Mar 12 '23 11:03

Vivekraj K R


1 Answers

translate3d(50%,0,0) considers the percentage as of the element itself, so it is being translated from the left half of the element size.

The left of the div that is positioned absolute in the fiddle is relative to the container div which is positioned relative, so the left:50%;is 50% of this container.

like image 195
KAD Avatar answered Apr 29 '23 13:04

KAD