css animation transformation center by screen center - css

How to make a body transformation has occurred relative to the center of the screen, not the center of the page along the Y-axis ?
link to the code
http://codepen.io/anon/pen/gPqKXe
it is more text for publish1 it is more text for publish2
.blok {
height: 100px;
background-color: #92FF00;
border: 2px solid black;
font-size:36px;
text-align: center;
padding: 85px 0 35px 0 ;
}
body {
transform: perspective( 200px );
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 0% 50%;
-webkit-animation: rotateRightSideFirst 5s forwards ease-in;
-moz-transform-style: preserve-3d;
-moz-transform-origin: 0% 50%;
-moz-animation: rotateRightSideFirst 5s forwards ease-in;
transform-style: preserve-3d;
transform-origin: 50% 50%;
animation: rotateRightSideFirst 5s forwards ease-in;
}
#-webkit-keyframes rotateRightSideFirst {
50% { -webkit-transform: translateZ(-700px) ;
-webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: translateZ(-200px); }
}
#-moz-keyframes rotateRightSideFirst {
50% { -moz-transform: translateZ(-700px) ; -moz-animation-timing-function: ease-out; }
100% { -moz-transform: translateZ(-200px); }
}
#keyframes rotateRightSideFirst {
50% { transform: translateZ(-700px) ; animation-timing-function: ease-out; }
100% { transform: translateZ(-200px); }
}
<div class="blok">1</div>
<div class="blok">2</div>
<div class="blok">3</div>
<div class="blok">4</div>
<div class="blok">5</div>
<div class="blok">6</div>
<div class="blok">7</div>
<div class="blok">8</div>
<div class="blok">9</div>
<div class="blok">10</div>
<div class="blok">11</div>
<div class="blok">12</div>
<div class="blok">13</div>
<div class="blok">14</div>
<div class="blok">15</div>
<div class="blok">16</div>
<div class="blok">17</div>
<div class="blok">18</div>

I'm not sure but maybe you would like to have a div wrapper thats fixed on screen. Following css rule would help you:
.fixedWrapper {
position: fixed;
left: 0px;
right: 0px;
height:100%;
width:100%
}
And
<div class="fixedWrapper">
... your html content...
</div>
If you'd like to have it in center of page (along the header and footer) you would create a wrapper and position it absolute with left & top 50% and with transform: translate(-50%, -50%) as well.

If .blok haa a width set you can use margin: 0 auto;.
Otherwise:
.blok {
position: relative;
left: 50%;
transform: translateX(-50%);
}

Related

Convert 2d image to 3d image

I have a 2d image in my html which I would like to style it to appear 3d with css but I keep searching the internet and no luck. To add I want the logo to rotate as well. The image is planet earth and I wanted to rotate like that in the navbar. Again have researched and what I get is to rotate the y,x, and z and sometimes to use photoshop.
Here is my code:
* {
box-sizing: border-box;
}
.index-header {
width: 100%;
height: 100px;
background-color: #000;
}
.index-header .index-logo {
float: left;
height: 100px;
width: 100px;
perspective: 360px;
transform: scale3d(360deg);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"  />
<meta name="viewport"  content="width=device-width, initial-scale=1.0"  />
<link rel="stylesheet"  href="style.css"  />
<title>Document</title>
</head>
<body>
<header class="index-header">
<img src="logo/logo.png"  alt=""  class="index-logo"  />
</header>
</body>
</html>
Do you mean something like this?
#import url(https://fonts.googleapis.com/css?family=Sigmar+One);
body {
margin: 0;
text-align: center;
background: #F4F1F8;
}
h1 {
font-family: 'Sigmar One', cursive;
color: #FFC84D;
}
h4 {
font-family: monospace;
}
section {
display: block;
width: 660px;
margin: 0 auto;
}
div {
height: 120px;
width: 220px;
}
.container {
position: relative;
display: inline-block;
height: 120px;
margin: 0 2em 2em 0;
opacity: .7;
border-radius: 5px;
background: #E4E1E4;
-webkit-perspective: 400px;
perspective: 400px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.transform {
position: absolute;
bottom: 0;
background: rgba(65, 245, 254, .5);
border-radius: 5px;
-webkit-animation: notransform 5s infinite;
animation: notransform 5s infinite;
}
.translate3d {
-webkit-transform: translate3d(20px,20px,20px);
-ms-transform: translate3d(20px,20px,20px);
transform: translate3d(20px,20px,20px);
}
.scale3d {
-webkit-transform: scale3d(0,0,1);
-ms-transform: scale3d(0,0,1);
transform: scale3d(0,0,1);
-webkit-animation-delay: .5s;
animation-delay: .5s;
}
.rotate3d {
-webkit-transform: rotate3d(1, .5, 1, -30deg);
-ms-transform: rotate3d(1, .5, 1, -30deg);
transform: rotate3d(1, .5, 1, -30deg);
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.rotateX {
-webkit-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
transform: rotateX(180deg);
-webkit-animation-delay: 1.5s;
animation-delay: 1.5s;
}
.rotateY {
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.rotateZ {
-webkit-transform: rotateZ(180deg);
-ms-transform: rotateZ(180deg);
transform: rotateZ(180deg);
-webkit-animation-delay: 2.5s;
animation-delay: 2.5s;
}
#-webkit-keyframes notransform {
50% {transform: none;}
}
#keyframes notransform {
50% {transform: none;}
}
<h1>CSS3 3D Transform examples</h1>
<section>
<div class="container">
<div class="transform translate3d"><h4>translate3d(20px,20px,20px)</h4></div>
</div>
<div class="container">
<div class="transform scale3d"><h4>scale3d(0,0,1)</h4></div>
</div>
<div class="container">
<div class="transform rotate3d"><h4>rotate3d(1, .5, 1, -30deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateX"><h4>rotateX(180deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateY"><h4>rotateY(180deg)</h4></div>
</div>
<div class="container">
<div class="transform rotateZ"><h4>rotateZ(180deg)</h4></div>
</div>
</section>

How to add a slow zoom in effect to slider images using slick slider?

I am trying to replicate the slow zoom in effect that the slider uses on this website: https://www.palazzokitchens.co.nz/
I'm using slick slider, how can I achieve this effect?
I have tried using scale(1.5) with a long transition but this also makes its children scale as well.
I have setup a slider demo have, any help is much appreciated: https://codepen.io/ifusion/pen/EvRPOB
Use this code and please see code in full page.
$(document).ready(function() {
$('.hero-slider').slick({
arrows: false,
autoplay: true,
autoplaySpeed: 3000
});
});
.no-overflow {
overflow: hidden;
}
.columns{
position:relative;
}
.hero-image {
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
height: 550px;
position: relative;
width: 100%;
}
.hero-text {
font-size: 50px;
color: white;;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.slick-slider { overflow: hidden; }
.slick-slider div.slick-active .hero-image {
-webkit-animation: myMove 8s 1 ease-in-out;
-moz-animation: myMove 8s 1 ease-in-out;
-o-animation: myMove 8s 1 ease-in-out;
-ms-animation: myMove 8s 1 ease-in-out;
animation: myMove 8s 1 ease-in-out;
}
#keyframes myMove {
from { transform: scale(1.0,1.0); transform-origin: 50% 50%; }
to { transform: scale(1.1,1.1); transform-origin: 50% 0%; }
}
#-webkit-keyframes myMove {
from { -webkit-transform: scale(1.0,1.0); -webkit-transform-origin: 50% 50%; }
to { -webkit-transform: scale(1.1,1.1); -webkit-transform-origin: 50% 0%; }
}
#-o-keyframes myMove {
from { -o-transform: scale(1.0,1.0); -o-transform-origin: 50% 50%; }
to { -o-transform: scale(1.1,1.1); -o-transform-origin: 50% 0%; }
}
#-moz-keyframes myMove {
from { -moz-transform: scale(1.0,1.0); -moz-transform-origin: 50% 50%; }
to { -moz-transform: scale(1.1,1.1); -moz-transform-origin: 50% 0%; }
}
#-ms-keyframes myMove {
from { -ms-transform: scale(1.0,1.0); -ms-transform-origin: 50% 50%; }
to { -ms-transform: scale(1.1,1.1); -ms-transform-origin: 50% 0%; }
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script>
<div class="hero-slider">
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/city-q-c-1900-500-6.jpg')">
</div>
<div class="hero-text">Dummy text in here 1</div>
</div>
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/technics-q-c-1900-500-8.jpg')">
</div>
<div class="hero-text">Dummy text in here 2</div>
</div>
<div class="columns">
<div class="hero-image" style="background-image: url('http://lorempixel.com/output/nature-q-c-1900-500-5.jpg')">
</div>
<div class="hero-text">Dummy text in here 3</div>
</div>
</div>
You need to separate image from slide and animate only image:
Updated codepen

Transform rotate and translate of circle img inside another img

I am trying to animate a sun with the outer rays slowly rotating. I have two images: sun_inner and sun_outer. I use absolute positioning and transform:translate to center the inner sun within the container. However, when I try to rotate the inner sun (which has a smiley face) a few degrees it is not rotating along the center axis, and the inner sun is moving up and down.
Any help in getting the rotation of the inner sun to be centered within the container is appreciated!
As an example here is a fiddle: https://jsfiddle.net/4mcdLcus/
.sun-inner {
position: absolute;
left: 50%;
top: 50%;
/*
In the animation I apply translateY(-50%) translateX(-50%)
to keep the inner circle centered, which is not working.
If I have translateY(-50%) translateX(-50%) without the rotation
it is centered properly
*/
animation-name: sun_inner_rotate;
animation-duration: 10s;
animation-iteration-count: infinite;
transform-origin: 50% 50%;
}
.sun-inner img {
height: 150px;
width: 150px;
}
.sun-outer {
animation-name: sun_outer_rotate;
animation-duration: 30s;
animation-iteration-count: infinite;
width: 300px;
height: 300px;
}
.sun-outer img {
width: 300px;
height: 300px;
}
#keyframes sunrise {
0% {
bottom: -130vh;
}
100% {
bottom: 0;
}
}
#keyframes sun_inner_rotate {
0% {
transform: rotate(0deg) translateY(-50%) translateX(-50%);
;
}
33% {
transform: rotate(12deg) translateY(-50%) translateX(-50%);
}
66% {
transform: rotate(-26deg) translateY(-50%) translateX(-50%);
}
100% {
transform: rotate(10deg) translateY(-50%) translateX(-50%);
}
}
#keyframes sun_outer_rotate {
0% {
transform: rotate(0deg);
}
33% {
transform: rotate(360deg);
}
66% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-360deg);
}
}
.sunContainer {
width: 300px;
height: 300px;
position: relative;
margin-left: 10%;
margin-top: 7%;
animation-iteration-count: 1;
animation-name: sunrise;
animation-duration: 1.5s;
display: flex;
justify-content: center;
align-items: center;
}
<div class="sunContainer">
<div class="sun-inner">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
<div class="sun-outer">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
</div>
No, you don't need to use two animations or do anything additional to the #keyframes that is already configured. All that is required is to only set the transform-origin properly for the inner element.
The inner element is originally positioned at top: 50% and left: 50% of the parent element (which in other words means that the top left of the inner element is at the center point of the parent). Afterwards it is vertically and horizontally centered using transform: translateX(-50%) translateY(-50%) trick.
So, when you rotate the element the transform-origin should be set as left top for the element to rotate around the center point of the parent. Only then it will remain perfectly centered.
.sun-inner {
position: absolute;
left: 50%;
top: 50%;
height: 150px;
width: 150px;
animation-name: sun_inner_rotate;
animation-duration: 10s;
animation-iteration-count: infinite;
transform-origin: left top; /* note the change */
}
.sun-inner img, .sun-outer img {
height: 100%;
width: 100%;
}
.sun-outer {
animation-name: sun_outer_rotate;
animation-duration: 30s;
animation-iteration-count: infinite;
width: 300px;
height: 300px;
}
#keyframes sunrise {
0% {
bottom: -130vh;
}
100% {
bottom: 0;
}
}
#keyframes sun_inner_rotate {
0% {
transform: rotate(0deg) translateY(-50%) translateX(-50%);
}
33% {
transform: rotate(12deg) translateY(-50%) translateX(-50%);
}
66% {
transform: rotate(-26deg) translateY(-50%) translateX(-50%);
}
100% {
transform: rotate(10deg) translateY(-50%) translateX(-50%);
}
}
#keyframes sun_outer_rotate {
0% {
transform: rotate(0deg);
}
33% {
transform: rotate(360deg);
}
66% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-360deg);
}
}
.sunContainer {
width: 300px;
height: 300px;
position: relative;
margin-left: 10%;
margin-top: 7%;
animation-iteration-count: 1;
animation-name: sunrise;
animation-duration: 1.5s;
display: flex;
justify-content: center;
align-items: center;
}
<div class="sunContainer">
<div class="sun-inner">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
<div class="sun-outer">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
</div>
Alternately, you can invert the order in which the transforms are applied on the element. You can apply the rotate first on the element and then apply translateX and translateY on the rotated element. This will also keep it perfectly centered. (When multiple transforms are specified, the first one from the right is always executed first and the last one from right is always executed last).
.sun-inner {
position: absolute;
left: 50%;
top: 50%;
height: 150px;
width: 150px;
animation-name: sun_inner_rotate;
animation-duration: 10s;
animation-iteration-count: infinite;
transform-origin: 50% 50%;
}
.sun-inner img, .sun-outer img {
height: 100%;
width: 100%;
}
.sun-outer {
animation-name: sun_outer_rotate;
animation-duration: 30s;
animation-iteration-count: infinite;
width: 300px;
height: 300px;
}
#keyframes sunrise {
0% {
bottom: -130vh;
}
100% {
bottom: 0;
}
}
#keyframes sun_inner_rotate { /* note the change to the order */
0% {
transform: translateY(-50%) translateX(-50%) rotate(0deg);
}
33% {
transform: translateY(-50%) translateX(-50%) rotate(12deg);
}
66% {
transform: translateY(-50%) translateX(-50%) rotate(-26deg);
}
100% {
transform: translateY(-50%) translateX(-50%) rotate(10deg);
}
}
#keyframes sun_outer_rotate {
0% {
transform: rotate(0deg);
}
33% {
transform: rotate(360deg);
}
66% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-360deg);
}
}
.sunContainer {
width: 300px;
height: 300px;
position: relative;
margin-left: 10%;
margin-top: 7%;
animation-iteration-count: 1;
animation-name: sunrise;
animation-duration: 1.5s;
display: flex;
justify-content: center;
align-items: center;
}
<div class="sunContainer">
<div class="sun-inner">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
<div class="sun-outer">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b6/Compass_360_%28en%29.svg">
</div>
</div>

overlapping each other when performing rotate3d animation on one of them

I have a few divs in a container:
<div class="waves-container" id="waves_container">
<div class="wave-wrapper wave-back">
<img src="static/images/waves/sea_back.png" class="wave-top" />
<div class="wave-bottom"></div>
</div>
<div class="wave-wrapper wave-front">
<img src="static/images/waves/sea-front.png" class="wave-top" />
<div class="wave-bottom" id="wave_bottom_front">Some additional divs are created here dynamically with JS</div>
</div>
<div class="play-button" id="play_button">
<img src="static/images/ccs_shake_waves/play.png" />
</div>
</div>
Their CSS:
.waves-container {
width: 100%;
height: 50%;
position: absolute;
bottom: -35%;
-webkit-transition: bottom 0.4s ease-in-out;
}
.wave-wrapper {
width: 105%;
height: 130%;
position: absolute;
left: -5%;
}
.wave-top {
width:100%;
height: auto;
position:relative;
bottom: 0;
left: 0;
float: left;
}
.wave-bottom {
width: 100%;
height: 130%;
position: relative;
clear:both;
float: left;
background-color: #fd51df;
}
.wave-back {
-webkit-animation: wave 3s 1s infinite linear;
top: 1.5%;
}
.wave-front {
top: -12%;
-webkit-animation: wave 3s infinite linear;
}
.play-button {
width: 70%;
height: auto;
position: relative;
margin: 0 auto;
top: 50%;
-webkit-transform: translateY(-50%) scale(0, 0);
z-index:1;
display: none;
}
With JS on a certain event I'm attaching an animation class to #play_button:
.pop-play {
-webkit-animation: flipInY 1s 1 forwards ease-out, play 3s 1s infinite linear;
}
In flipInY I'm animating this div on Y axis:
#-webkit-keyframes flipInY {
0% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg) translateY(-50%);
-webkit-transition-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg) translateY(-50%);
-webkit-transition-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg) translateY(-50%);
opacity: 1;
}
80% {
-webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg) scale(1.05, 1) translateY(-50%);
}
100% {
-webkit-transform: perspective(400px) scale(1.1, 1) translateY(-50%);
-webkit-transition-timing-function: ease-out;
}
}
In Android I see it just fine. However in iOS the play_button div overlaps with underlying div when it flips on Y axis, so every time I see 50% of the image, the rest of that div is "under" another div.
I tried to add -webkit-transform: translate3d(0,0,0); to every underlying div, tried to change z-indexes, tried to combine it, tried to use
-webkit-perspective: 1000;
-webkit-transform-style: preserve-3d;
on the waves-container div and all the child divs, but they're still overlapping, until the flipping animation finishes and the other begins.
Why is it happening and how can I fix it?

How can I reverse keyframe on hover off?

I'm working on a card flip animation using keyframes. Aside from the fact I need the origin of the animation to be in the middle, the card flips fine on hover. However, I need to "unflip" on hover off. Right now it's just resetting and not animating.
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipcard 1s 0s 1 normal forwards;
-moz-animation: flipcard 1s 0s 1 normal forwards;
animation: flipcard 1s 0s 1 normal forwards; }
I've created a jsfiddle to show what's happening
Dont use keyframe animation for hover effects Just removed #keyframe css rules and added it inside containers on hover so that it will automatically handles hover off effect!
Here is the code jSfiddle
for FullScreen jsFiddle
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.oisqa-widget {
float: left;
width: 100%;
}
.oisqa-widget .flip-container {
height: 170px;
}
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: scale(2) rotateY(180deg);
}
.oisqa-widget .flip-container {
display: block;
float: left;
margin-right: 2.12766%;
width: 31.91489%;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
.oisqa-widget .flip-container:last-child {
margin-right: 0;
}
.oisqa-widget .flipper {
position: relative;
transition: 0.6s;
transform-style: preserve-3d;
}
.oisqa-widget .front,
.oisqa-widget .back {
position: absolute;
top: 0px;
left: 0px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
height: 170px;
padding: 20px;
text-align: center;
width: 100%;
}
.oisqa-widget .front {
background: white;
border: 1px #c3c3c3 solid;
border-top: 5px #1c4295 solid;
transform: rotateY(0deg);
z-index: 2;
}
.oisqa-widget .back {
background: #1c4295;
border: 1px #c3c3c3 solid;
border-top: 5px #f4f4f4 solid;
color: white;
transform: rotateY(180deg);
}
.oisqa-widget .back strong {
color: white;
}
.oisqa-widget strong {
color: #1c4295;
}
<div class="oisqa-widget">
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 1</p>
</div>
<div class="back">
<p class="question">answer 1</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 2</p>
</div>
<div class="back">
<p class="question">answer 2</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 3</p>
</div>
<div class="back">
<p class="question">answer 3</p>
</div>
</div>
</div>
</div>
This will seem a little convoluted so bear with me...
To get the desired effect I used 3 separate animations, 2 of which are the same as your current flipcard animation, so you'll end up with flipcard, flipcard2, and hideAnswer.
To get the flipcard animation to work in both directions you'll need to add flipcard2 to the initial state of .flipper, I know this seems odd, but the hover state and the initial state need to use animations with different names, you can't use the same animation and just flip the direction. So:
.oisqa-widget .flipper {
position: relative;
/*transition: 0.6s; remove this */
transform-style: preserve-3d;
-webkit-animation: flipcard2 1s 0s 1 reverse forwards;
-moz-animation: flipcard2 1s 0s 1 reverse forwards;
animation: flipcard2 1s 0s 1 reverse forwards;
/*note that flipcard and flipcard2 are the same but here the direction is reversed*/
}
Now just doing this will get your animation going in both directions, but your answers will show when the page first loads.
To prevent that you'll need to hide everything for the first second while the animation plays through on the initial state, hence the 3rd animation hideAnswer:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
animation: hideAnswer 1s;
}
#keyframes hideAnswer {
0%{opacity: 0;}
99%{opacity: 0;}
100%{opacity:1;}
}
Now put it all together and you'll get:
Working Example on jsFiddle
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-animation: hideAnswer 1s;
-o-animation: hideAnswer 1s;
-moz-animation: hideAnswer 1s;
animation: hideAnswer 1s;
}
#-o-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-webkit-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-moz-keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#keyframes hideAnswer {
0% {
opacity: 0;
}
99% {
opacity: 0;
}
100% {
opacity:1;
}
}
#-webkit-keyframes flipcard {
0% {
-webkit-transform: scale(1) rotateY(0);
}
50% {
-webkit-transform: scale(2) rotateY(180deg);
}
100% {
-webkit-transform: scale(1) rotateY(180deg);
}
}
#-moz-keyframes flipcard {
0% {
-moz-transform: scale(1) rotateY(0);
}
50% {
-moz-transform: scale(2) rotateY(180deg);
}
100% {
-moz-transform: scale(1) rotateY(180deg);
}
}
#-o-keyframes flipcard {
0% {
-o-transform: scale(1) rotateY(0);
}
50% {
-o-transform: scale(2) rotateY(180deg);
}
100% {
-o-transform: scale(1) rotateY(180deg);
}
}
#keyframes flipcard {
0% {
transform: scale(1) rotateY(0);
}
50% {
transform: scale(2) rotateY(180deg);
}
100% {
transform: scale(1) rotateY(180deg);
}
}
#-webkit-keyframes flipcard2 {
0% {
-webkit-transform: scale(1) rotateY(0);
}
50% {
-webkit-transform: scale(2) rotateY(180deg);
}
100% {
-webkit-transform: scale(1) rotateY(180deg);
}
}
#-moz-keyframes flipcard2 {
0% {
-moz-transform: scale(1) rotateY(0);
}
50% {
-moz-transform: scale(2) rotateY(180deg);
}
100% {
-moz-transform: scale(1) rotateY(180deg);
}
}
#-o-keyframes flipcard2 {
0% {
-o-transform: scale(1) rotateY(0);
}
50% {
-o-transform: scale(2) rotateY(180deg);
}
100% {
-o-transform: scale(1) rotateY(180deg);
}
}
#keyframes flipcard2 {
0% {
transform: scale(1) rotateY(0);
}
50% {
transform: scale(2) rotateY(180deg);
}
100% {
transform: scale(1) rotateY(180deg);
}
}
.oisqa-widget {
float: left;
width: 100%;
}
.oisqa-widget .flip-container {
height: 170px;
}
.oisqa-widget .flip-container {
display: block;
float: left;
margin-right: 2.12766%;
width: 31.91489%;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
.oisqa-widget .flip-container:last-child {
margin-right: 0;
}
.oisqa-widget .flip-container:hover .flipper {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipcard 1s 0s 1 normal forwards;
-moz-animation: flipcard 1s 0s 1 normal forwards;
animation: flipcard 1s 0s 1 normal forwards;
}
.oisqa-widget .flipper {
position: relative;
/*transition: 0.6s; remove this */
transform-style: preserve-3d;
-webkit-animation: flipcard2 1s 0s 1 reverse forwards;
-moz-animation: flipcard2 1s 0s 1 reverse forwards;
animation: flipcard2 1s 0s 1 reverse forwards;
}
.oisqa-widget .front, .oisqa-widget .back {
position: absolute;
top: 0px;
left: 0px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
height: 170px;
padding: 20px;
text-align: center;
width: 100%;
}
.oisqa-widget .front {
background: white;
border: 1px #c3c3c3 solid;
border-top: 5px #1c4295 solid;
transform: rotateY(0deg);
z-index: 2;
}
.oisqa-widget .back {
background: #1c4295;
border: 1px #c3c3c3 solid;
border-top: 5px #f4f4f4 solid;
color: white;
transform: rotateY(180deg);
}
.oisqa-widget .back strong {
color: white;
}
.oisqa-widget strong {
color: #1c4295;
}
<div class="oisqa-widget">
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 1</p>
</div>
<div class="back">
<p class="question">answer 1</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 2</p>
</div>
<div class="back">
<p class="question">answer 2</p>
</div>
</div>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<p class="question">question 3</p>
</div>
<div class="back">
<p class="question">answer 3</p>
</div>
</div>
</div>
</div>

Resources