translateX and translateY on same element?

Evanss picture Evanss · Apr 15, 2015 · Viewed 52.3k times · Source

Is it possible to apply a CC translate X and Y on the same element?

If I try this the translateX is overridden by the translateY:

.something { 
        transform: translateX(-50%);
        transform: translateY(-50%);
}

Answer

Akshay picture Akshay · Apr 15, 2015

You can do something like this

transform:translate(-50%,-50%);