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

CSS

backface-visibility not working for me

Hello, I'm currently having the same issue. I followed Guil's code but it's not working for me.

web-kit backface-visibility doesn't work for me either

/* ================================= Photo 3D Transforms & Transitions ==================================== */

.content { perspective: 700px; }

.photo { transition: transform 1s cubic-bezier(.55, -.62, .27, 1.2);

}

.photo:hover { transform: rotateY(-180deg);

}

.side-a, .side-b { backface-visibility: hidden; transform-style: preserve-3d; }

.side-b { transform: rotateY(180deg); }

4 Answers

Steven Parker
Steven Parker
231,261 Points

Try setting the 3-D style on the element that is being rotated:

.photo {
  transition: transform 1s cubic-bezier(.55, -.62, .27, 1.2);
  transform-style: preserve-3d;                              /* <-- add this */
}

Steven, after commenting out the transition property and adding the transform-style property to .photo, it still doesn't create the front and back images like in the video.

/* ================================= Photo 3D Transforms & Transitions ==================================== */

.content { perspective: 700px; }

.photo { /* transition: transform 1s cubic-bezier(.55, -.62, .27, 1.2); */ transform-style: preserve-3d; }

.photo:hover { transform: rotate3d(1, 0, 0, 180deg); }

.side-a, .side-b { backface-visibility: hidden; }

.side-b { transform: rotateX(180deg); }

Steven Parker
Steven Parker
231,261 Points

I was only suggesting adding that property, not removing any.
Without the transition, it works but the "flip" is instant instead of animated; so put that back in. :wink:

Thank you Steven!

Ok I'll do that.