Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

CSS3 transform not working properly with Webkit?

CSS3 transform not working properly with Webkit?

Problem

I'm trying to rig up a demo I found with Webkit that should have one image on one side of a frame and flip to another image. Instead, webkit just decides to show me the back image on both sides, mirrored. Any help is appreciated very much!

Fiddle: http://jsfiddle.net/sH2jZ/

CSS:

    #f1_container {
    position: relative;
    margin: 10px auto;
    width: 450px;
    height: 281px;
    z-index: 1;
    }
    #f1_container {
    perspective: 1000;
    }
    #f1_card {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 1.0s linear;
    }
    #f1_container:hover #f1_card {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    box-shadow: -5px 5px 5px #aaa;
    }
    .face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    }
    .face.back {
    display: block;
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    box-sizing: border-box;
    color: white;
    text-align: center;
    background-color: #aaa;
    }

HTML:

    
Problem courtesy of: Mr. Lavalamp

Solution

You've missed -webkit- version for couple of your transform-related statements:

#f1_container {
    position: relative;
    margin: 10px auto;
    width: 450px;
    height: 281px;
    z-index: 1;
}
#f1_container {
    perspective: 1000;
}
#f1_card {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: all 1.0s linear;
    -webkit-transition: all 1.0s linear;
}
#f1_container:hover #f1_card {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    box-shadow: -5px 5px 5px #aaa;
}
.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.face.back {
    display: block;
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    box-sizing: border-box;
    color: white;
    text-align: center;
    background-color: #aaa;
}

DEMO

Solution courtesy of: MarcinJuraszek

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

CSS3 transform not working properly with Webkit?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×