DEV Community

Discussion on: My 5 favorite CSS tricks I learned this year

Collapse
 
uxguy profile image
UX-Guy

For the vertical alignment, you mistakenly transform translateX, instead of Y.
.container {
position:absolute;
top: -50%;
transform: translateY(50%);
margin: auto;
}

Collapse
 
urielbitton profile image
Uriel Bitton

Ah yes thanks for pointing out! I will edit it :)

Collapse
 
alvaromontoro profile image
Alvaro Montoro

Also, those values will push the .container outside of the screen. I should be:

    top: 50%;
    transform: translateY(-50%);
Thread Thread
 
urielbitton profile image
Uriel Bitton

Right i believe i edited that :)