Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jonah Shi
10,140 PointsAbout the animation demo, are there any reason using translate3d? CSS Variables vs. Preprocessor Variables
About the animation demo, are there any reason using translate3d? Can I use translate(), as the z value is 0 all the time?
@keyframes bounce{ 50% {transform: translate3d(0, 80vh, 0);} } @keyframes slide{ 50% {transform: translate3d(80vw, 0, 0);} } @keyframes diag{ 50% {transform: translate3d(80vw, 80vh, 0);} }
INstead, using @keyframes bounce{ 50% {transform: translate(0, 80vh);} } @keyframes slide{ 50% {transform: translate(80vw, 0);} } @keyframes diag{ 50% {transform: translate(80vw, 80vh);} }
1 Answer
Steven Parker
243,318 PointsYou're quite right that without an z-axis changes, translate3d and translate are interchangeable.
You didn't link to the course page, but I would guess that this particular demo might be to simply introduce the parameter and there might be more to follow that will demonstrate the 3-D effects.