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 Unused CSS Stages Transitions and Transforms 3D Transforms: Part 2

Thiago de Bastos
Thiago de Bastos
14,556 Points

CSS3 Page Flip

Hey guys! I have been struggling with creating a working CSS3 page flip event. I have been ok with the mouseover flip, the issue that I am having is when I mouse out. The flip seems to bug and reset. What am I doing wrong?

<body>
    <div class="wrap">
        <div class="side-a"></div>
        <div class="side-b"></div>
    </div>

    <div class="flip-container" ontouchstart="this.classList.toggle('hover');">
    <div class="flipper">
        <div class="front">
            <!-- front content -->
        </div>
        <div class="back">
            <!-- back content -->
        </div>
    </div>
</div>
body {
    -webkit-perspective: 800px;
    -webkit-perspective-origin: center center;
}

.wrap {
    transition: -webkit-transform 0.5s ease-in-out;
    -webkit-transform-style: preserve-3d;
}

.wrap div {
    position: absolute;
    -webkit-backface-visibility: hidden;
}

.side-a {
    z-index: 100;
}

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

.wrap:hover {
    -webkit-transform: rotate3d(0, 1, 0, 180deg);
    -webkit-transform-origin: center right;
}

1 Answer

Thiago de Bastos
Thiago de Bastos
14,556 Points

I figured this out. Thanks anyway