* {
    margin: 0;
    padding: 0;
    border: 0;
}

body {
    width: 640px;
    height: 960px;
}

#flip
{
    -webkit-transform-style: preserve-3d;
    -webkit-perspective: 3000;
    -webkit-perspective-origin: 320px 480px;
}

img {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 640px;
    height: 960px;

    -webkit-backface-visibility: hidden;
}

#front.stay {
    -webkit-transition-property: none;
    -webkit-transform: rotateY(0deg);
}
#back.stay {
    -webkit-transition-property: none;
    -webkit-transform: rotateY(180deg);
}
#front.flip {
    -webkit-transition-property: -webkit-transform;
    -webkit-transition-duration: 2s;
    -webkit-transform: rotateY(180deg);
}
#back.flip {
    -webkit-transition-property: -webkit-transform;
    -webkit-transition-duration: 2s;
    -webkit-transform: rotateY(360deg);
}