.featured_widgets {
margin: 4% 0px;
}
.featured_widgets .columns {
display: table;
margin-bottom: 20px;
text-align: center;
}
.featured_widgets .widget_box {
height: 156px;
text-align: center;
margin: 0px 1%;
vertical-align: middle;
width: 100%;
display: table-cell;
padding: 0px 20px;
}
.featured_widgets .widget_box .front img {
height: 120px;
}
.featured_widgets .widget_box .front {
height: 140px;
}
.featured_widgets .widget_box .back {
height: 140px;
padding-top: 40px;
color: #fff;
font-size: 17px;
}
.featured_widgets .columns .title {
display: table-row;
}
.featured_widgets .columns .title h5 {
color: #999;
padding: 0px 15px;
font-size: 15px;
}
.flip-container {
transform: perspective(1000px);
transform-style: preserve-3d;
}
.flip-container:hover .back,
.flip-container.hover .back {
transform: rotateY(0deg);
}
.flip-container:hover .front,
.flip-container.hover .front {
transform: rotateY(180deg);
}
.flipper {
perspective: 800px;
perspective-origin: 50% 100px;
position: relative;
transform: perspective(1000px);
transform-style: preserve-3d;
transition: all 0.6s ease 0s;
}
.front,
.back {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
}
.front {
z-index: 2;
}
.back {
margin-top: -180px;
text-align: center;
transform: rotateY(-180deg);
}
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
}
.vertical.flip-container .flipper {
transform-origin: 100% 213.5px 0;
}
.vertical.flip-container:hover .back,
.vertical.flip-container.hover .back {
transform: rotateX(0deg);
}
.vertical.flip-container:hover .front,
.vertical.flip-container.hover .front {
transform: rotateX(180deg);
}
.seagreen_bg {
background: #1cbec9;
}
.inxblue_bg {
background: #0075ba;
}
.inxorange_bg {
background: #f37b20;
}
.inxyellow_bg {
background: #fdb813;
}
.btn_line {
border: 1px solid #fff;
border-radius: 5px;
display: inline-block;
font-size: 14px;
font-weight: normal;
margin-top: 10px;
padding: 8px 15px;
color: #fff;
}
.btn_line:hover {
background: #333 none repeat scroll 0 0;
border: 1px solid #000;
color: #fff;
text-decoration: none;
}
<div class="container">
<div class="row featured_widgets">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper seagreen_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text.</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxblue_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text.</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxorange_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="#">Learn More ›</a></h5>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text text text text text text</h5>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 columns flip-container vertical">
<div class="widget_box flipper inxyellow_bg">
<div class="front">
<img src="https://cdn.sparkfun.com/assets/9/9/2/5/e/51f9a101757b7f032ab7f724.png" alt="">
</div>
<div class="back">
<h5>text text text text text text.</h5>
<h5><a class="btn_line" href="">Learn More ›</a></h>
</div>
</div>
<div class="title">
<h4>text</h4>
<h5>text</h5>
</div>
</div>
</div>
</div>
You need the -webkit- prefix to make it work in safari:
-webkit-transform: rotateY(180deg);
See compatibility table:
http://caniuse.com/#search=transform
Try This-
.featured_widgets {
margin: 4% 0px;
}
.featured_widgets .columns {
display: table;
margin-bottom: 20px;
text-align: center;
}
.featured_widgets .widget_box {
height: 156px;
text-align: center;
margin: 0px 1%;
vertical-align: middle;
width: 100%;
display: table-cell;
padding: 0px 20px;
}
.featured_widgets .widget_box .front img {
height: 120px;
}
.featured_widgets .widget_box .front {
height: 140px;
}
.featured_widgets .widget_box .back {
height: 140px;
padding-top: 40px;
color: #fff;
font-size: 17px;
}
.featured_widgets .columns .title {
display: table-row;
}
.featured_widgets .columns .title h5 {
color: #999;
padding: 0px 15px;
font-size: 15px;
}
.flip-container {
transform:perspective(1000px);
-moz-transform:perspective(1000px);
-ms-transform:perspective(1000px);
-o-transform:perspective(1000px);
-webkit-transform:perspective(1000px);
transform-style:preserve-3d;
}
.flip-container:hover .back ,
.flip-container.hover .back {
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
}
.flip-container:hover .front ,
.flip-container.hover .front {
transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
}
.flipper {
perspective: 800px;
perspective-origin: 50% 100px;
position: relative;
transform: perspective(1000px);
-moz-transform: perspective(1000px);
-ms-transform: perspective(1000px);
-o-transform: perspective(1000px);
-webkit-transform: perspective(1000px);
transform-style: preserve-3d;
transition: all 0.6s ease 0s;
-moz-transition: all 0.6s ease 0s;
-ms-transition: all 0.6s ease 0s;
-o-transition: all 0.6s ease 0s;
-webkit-transition: all 0.6s ease 0s;
}
.front {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
-moz-transition: all 1s ease 0.3s;
-ms-transition: all 1s ease 0.3s;
-o-transition: all 1s ease 0.3s;
-webkit-transition: all 1s ease 0.3s;
z-index: 2;
}
.back {
backface-visibility: hidden;
position: relative;
transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
transform-style: preserve-3d;
transition: all 1s ease 0.3s;
-moz-transition: all 1s ease 0.3s;
-ms-transition: all 1s ease 0.3s;
-o-transition: all 1s ease 0.3s;
-webkit-transition: all 1s ease 0.3s;
}
.back {
margin-top: -180px;
text-align: center;
transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-webkit-transform: rotateY(-180deg);
}
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
}
.vertical.flip-container .flipper {
transform-origin: 100% 213.5px 0;
}
.vertical.flip-container:hover .back ,
.vertical.flip-container.hover .back {
transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
}
.vertical.flip-container:hover .front ,
.vertical.flip-container.hover .front {
transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
}
.seagreen_bg {
background: #1cbec9;
}
.inxblue_bg {
background: #0075ba;
}
.inxorange_bg {
background: #f37b20;
}
.inxyellow_bg {
background: #fdb813;
}
.btn_line {
border: 1px solid #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
display: inline-block;
font-size: 14px;
font-weight: normal;
margin-top: 10px;
padding: 8px 15px;
color: #fff;
}
.btn_line:hover {
background: #333 none repeat scroll 0 0;
border: 1px solid #000;
color: #fff;
text-decoration: none;
}
Related
I have problem with CSS below. In div with class front text is blurred like on this image
I'm using Chrome, but on every browser I see same blurred text. I want keep every div but I'm not sure what makes this text so blurred.
How I can fix it to make it no blure?
JsFiddle
HTML and CSS
.main {
margin: auto;
height: auto;
padding-top: 25px;
}
.panel {
width: 45%;
display: inline-block;
margin: 14px;
}
.est {
box-shadow: 0 0 0 #fff;
background-color: transparent;
}
.flip .back {
-webkit-transform: rotateY(360deg);
-moz-transform: rotateY(360deg);
-ms-transform: rotateY(360deg);
-o-transform: rotateY(360deg);
transform: rotateY(360deg);
}
#card-1,
#card-2,
#card-3,
#card-4,
#card-5 {
height: 300px;
width: 100%;
margin: 0 auto;
z-index: 1;
display: inline-block;
perspective: 700px;
}
h4,
.h4 {
font-size: 20px;
}
body {
font-size: 14px;
font-family: Roboto, sans-serif;
line-height: 1.35;
color: #222;
background: #f4f5f7;
text-rendering: optimizeLegibility;
padding: 0;
left: 0;
right: 0;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
.front {
-webkit-transform: rotateY(0);
-moz-transform: rotateY(0);
-ms-transform: rotateY(0);
-o-transform: rotateY(0);
transform: rotateY(0);
z-index: 1;
}
.back,
.front {
border: 1px solid #ddd;
height: 100%;
top: 0;
transform-style: preserve-3d;
backface-visibility: hidden;
}
.back,
.front,
.front .info-box,
.social-bar {
position: absolute;
left: 0;
width: 100%;
}
.ease {
-webkit-transition: all .45s ease-out;
-moz-transition: all .45s ease-out;
-ms-transition: all .45s ease-out;
-o-transition: all .45s ease-out;
transition: all .45s ease-out;
}
.e-i-f-about,
.front,
.p-class-earn,
.strike {
overflow: hidden;
}
.back,
.flip .front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.back,
.front {
border: 1px solid #ddd;
height: 100%;
top: 0;
transform-style: preserve-3d;
backface-visibility: hidden;
}
.back,
.front,
.front .info-box,
.social-bar {
position: absolute;
left: 0;
width: 100%;
}
.back {
background-color: #fff;
display: table;
z-index: 2;
font-size: 13px;
line-height: 23px;
padding: 10px 20px;
height: 320px;
}
<div class="main pad-2">
<center>
<h4>Not blurred text</h4>
<div class="panel e-b est" style="margin-top:0">
<div class="wrapper">
<div id="card-1">
<div class="front ease">
Click
<div class="info-box">
<div class="info">
<h4>test1 blurred text</h4>
</div>
</div>
</div>
<div class="back ease">
2nd text here
</div>
</div>
</div>
</div>
<div class="panel e-b est" style="margin-top:0">
<div class="wrapper">
<div id="card-2">
<div class="front ease">
Click
<div class="info-box">
<div class="info">
<h4>test2 blurred text</h4>
</div>
</div>
</div>
<div class="back ease">
2nd text here
</div>
</div>
</div>
</div>
</center>
</div>
I am trying to work out ihover with bootstrap but its not working. I searched for this problem and tried the solution provided but still its not working. The answer is not satisfactory.This is the code that I am trying to implement. I took it from this link. I added css from this link. Please tell me what am I missing?
<div class="col-md-6">
<div class="ih-item square effect7">
<a href="#">
<div class="img"><img src="homepage-pics/electrician.jpg"></div>
<div class="info">
<h3>Electrician</h3>
<p>Need an electrician?click here</p>
</div>
</a>
</div>
</div>
The issue is with the anchor in your .info p tag. if you remove the anchor from this <p>, it works.
.ih-item {
position: relative;
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item,
.ih-item * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.ih-item a {
color: #333
}
.ih-item a:hover {
text-decoration: none
}
.ih-item img {
width: 100%;
height: 100%
}
.ih-item.circle {
position: relative;
width: 220px;
height: 220px;
border-radius: 50%
}
.ih-item.circle .img {
position: relative;
width: 220px;
height: 220px;
border-radius: 50%
}
.ih-item.circle .img:before {
position: absolute;
display: block;
content: '';
width: 100%;
height: 100%;
border-radius: 50%;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.3);
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item.circle .img img {
border-radius: 50%
}
.ih-item.circle .info {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
border-radius: 50%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden
}
.ih-item.square {
position: relative;
width: 316px;
height: 216px;
border: 8px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3)
}
.ih-item.square .info {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
-webkit-backface-visibility: hidden;
backface-visibility: hidden
}
.ih-item.circle.effect7 .img {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
-webkit-transition: all 0.35s ease-out;
-moz-transition: all 0.35s ease-out;
transition: all 0.35s ease-out
}
.ih-item.circle.effect7.colored .info {
background: #1a4a72
}
.ih-item.circle.effect7 .info {
background: #333;
opacity: 0;
visibility: hidden;
pointer-events: none;
-webkit-transition: all 0.35s ease 0.2s;
-moz-transition: all 0.35s ease 0.2s;
transition: all 0.35s ease 0.2s
}
.ih-item.circle.effect7 .info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 55px 0 0 0;
height: 110px;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3)
}
.ih-item.circle.effect7 .info p {
color: #bbb;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5)
}
.ih-item.circle.effect7 a:hover .img {
opacity: 0;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
-ms-transform: scale(0.5);
-o-transform: scale(0.5);
transform: scale(0.5)
}
.ih-item.circle.effect7 a:hover .info {
visibility: visible;
opacity: 1
}
.ih-item.circle.effect7.left_to_right .info {
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-100%);
-o-transform: translateX(-100%);
transform: translateX(-100%)
}
.ih-item.circle.effect7.left_to_right a:hover .info {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0)
}
.ih-item.circle.effect7.right_to_left .info {
-webkit-transform: translateX(100%);
-moz-transform: translateX(100%);
-ms-transform: translateX(100%);
-o-transform: translateX(100%);
transform: translateX(100%)
}
.ih-item.circle.effect7.right_to_left a:hover .info {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0)
}
.ih-item.circle.effect7.top_to_bottom .info {
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%)
}
.ih-item.circle.effect7.top_to_bottom a:hover .info {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0)
}
.ih-item.circle.effect7.bottom_to_top .info {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
-ms-transform: translateY(-100%);
-o-transform: translateY(-100%);
transform: translateY(-100%)
}
.ih-item.circle.effect7.bottom_to_top a:hover .info {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0)
}
.ih-item.square.effect7 {
overflow: hidden
}
.ih-item.square.effect7.colored .info {
background: #1a4a72;
background: rgba(26, 74, 114, 0.6)
}
.ih-item.square.effect7.colored .info h3 {
background: rgba(12, 34, 52, 0.6)
}
.ih-item.square.effect7 .img {
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1)
}
.ih-item.square.effect7 .info {
background: #333;
background: rgba(0, 0, 0, 0.6);
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item.square.effect7 .info h3 {
text-transform: uppercase;
color: #fff;
text-align: center;
font-size: 17px;
padding: 10px;
background: #111;
margin: 30px 0 0 0;
-webkit-transform: scale(4);
-moz-transform: scale(4);
-ms-transform: scale(4);
-o-transform: scale(4);
transform: scale(4);
-webkit-transition: all 0.35s 0.1s ease-in-out;
-moz-transition: all 0.35s 0.1s ease-in-out;
transition: all 0.35s 0.1s ease-in-out
}
.ih-item.square.effect7 .info p {
font-style: italic;
font-size: 12px;
position: relative;
color: #bbb;
padding: 20px 20px 20px;
text-align: center;
-webkit-transform: scale(5);
-moz-transform: scale(5);
-ms-transform: scale(5);
-o-transform: scale(5);
transform: scale(5);
-webkit-transition: all 0.35s 0.3s linear;
-moz-transition: all 0.35s 0.3s linear;
transition: all 0.35s 0.3s linear
}
.ih-item.square.effect7 a:hover .img {
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2)
}
.ih-item.square.effect7 a:hover .info {
visibility: visible;
opacity: 1
}
.ih-item.square.effect7 a:hover .info h3,
.ih-item.square.effect7 a:hover .info p {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1)
}
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="ih-item square colored effect7">
<a href="#">
<div class="img">
<img src="http://gudh.github.io/ihover/dist/images/assets/rect/4.jpg" alt="img">
</div>
<div class="info">
<h3>Electrician</h3>
<p>Need an electrician?<!--click here-->
</p>
</div>
</a>
</div>
</div>
</div>
I'm trying to code a way to rotate a div on mouse hover and show a different content than before.
An example can be seen here: www.possibile.com
And here is my code for what I'm trying to do:
#container {
width: 500px;
height: 500px;
margin: 0 auto;
}
.rotate {
width: 200px;
height: 200px;
margin: 150px;
background-color: red;
-webkit-transition: 1s ease-in;
-moz-transition: 1s ease-in;
-o-transition: 1s ease-in;
transition: 1s ease-in;
}
.rotate:hover {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.rotate:hover > p.front {
display: none;
}
p.rear {
display: none;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.rotate:hover > p.rear {
display: block;
}
<div id="container">
<div class="rotate">
<p class="front">This is a div to rotate.</p>
<p class="rear">
This is the div rotated.
</p>
</div>
http://jsfiddle.net/wLLLsjLd/1/
The problem with my code is that whenever I hover upon the div, it shows the "rear" p at the beginning of the rotation and not in the end.
Any help?
You can check with the below link.
Fiddle
body {
background: #ecf0f1;
}
ul {
width: 50%;
margin: 120px auto;
}
li {
width: 200px;
height: 200px;
margin-right: 10px;
margin-bottom: 10px;
float: left;
list-style: none;
position: relative;
cursor: pointer;
font-family:'Open Sans';
font-weight: 300;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
div {
color: yellow;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.front {
z-index: 3;
color: #fff;
text-align: center;
line-height: 210px;
font-size: 20px;
background: #e3e3e3;
}
li:hover > .front{
z-index: 0;
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
li:hover > .back {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.back {
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
background: #34495e;
}
#box1 {
background: red;
}
Im hoping someone can help me get my code to flip my second image properly (not mirror image) when viewed in IE. I think I have it working properly in the other browsers.
My goal is to have picture #1 show, then upon button click show the picture #2.
The code also uses javascript + jquery but my knowledge currently is limited.
Can someone offer a solution via css that I can add or amend my code with to accomplish what I am trying to do? Thanks.
My fiddle: http://jsfiddle.net/zgn9kd0L/6/
HTML
<div id="block" class="block" onclick="changeClass()">
<div class="front side">
<img src="http://imgur.com/etY8veW.jpg" alt="" />
</div>
<div class="back side">
<img src="http://imgur.com/DiSXWpR.jpg" alt="" />
</div>
</div>
<button class="flip">Flip</button>
CSS
#container {
height: 500px;
width: 500px;
position: relative;
/*perspective*/
-webkit-perspective: 500;
-moz-perspective: 500;
-ms-perspective: 500;
-o-perspective: 500;
perspective: 500;
}
.block {
position: relative;
height: 500px;
width: 500px;
/*transform-style*/
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
/*transition*/
-webkit-transition: -webkit-transform 1.5s;
-moz-transition: -moz-transform 1.5s;
-o-transition: -o-transform 1.5s;
transition: transform 1.5s;
}
.rotated {
/*transform*/
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.side {
position: absolute;
/*backface-visibility*/
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
.front {
}
.back {
/*transform*/
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.flip {
background: white;
font-family: 'open sans';
font-weight: 400;
color: #5b5b5b;
border-radius: 5px;
margin-top: 1em;
}
IE10+ only has partial support for the property transform-style: preserve-3d. I assume that's why it wasn't working.
Here is a similar alternative that works in IE. (updated example)
HTML
<div class="block">
<div class="front side">
<img src="http://imgur.com/etY8veW.jpg" alt="" />
</div>
<div class="back side">
<img src="http://imgur.com/DiSXWpR.jpg" alt="" />
</div>
</div>
CSS - vendor prefixes omitted. See the example.
.block {
width: 500px;
height: 500px;
position: relative;
perspective: 500;
}
.side {
position: absolute;
transition: transform 0.5s;
backface-visibility: hidden;
}
.side.rotated {
transform: rotateY(360deg);
}
.back {
transform: rotateY(180deg);
}
If you are looking for Pure CSS Solutions here are few:
Create a CSS Flipping Animation
Working Demo
HTML:
<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="front">
<span class="name">David Walsh</span>
</div>
<div class="back">
<div class="back-logo"></div>
<div class="back-title">#davidwalshblog</div>
<p>Mozilla Web Developer, MooTools & jQuery Consultant, MooTools Core Developer, Javascript Fanatic, CSS Tinkerer, PHP Hacker, and web lover.</p>
</div>
</div>
</div>
CSS:
.flip-container {
-webkit-perspective: 1000;
-moz-perspective: 1000;
-o-perspective: 1000;
perspective: 1000;
border: 1px solid #ccc;
}
.flip-container:hover .flipper,
.flip-container.hover .flipper {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 320px;
height: 427px;
}
.flipper {
-webkit-transition: 0.6s;
-webkit-transform-style: preserve-3d;
-moz-transition: 0.6s;
-moz-transform-style: preserve-3d;
-o-transition: 0.6s;
-o-transform-style: preserve-3d;
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
background: url(http://davidwalsh.name/demo/dwflip.jpg) 0 0 no-repeat;
z-index: 2;
}
.back {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
background: #f8f8f8;
}
.front .name {
font-size: 2em;
display: inline-block;
background: rgba(33, 33, 33, 0.9);
color: #f8f8f8;
font-family: Courier;
padding: 5px 10px;
border-radius: 5px;
bottom: 60px;
left: 25%;
position: absolute;
text-shadow: 0.1em 0.1em 0.05em #333;
-webkit-transform: rotate(-20deg);
-moz-transform: rotate(-20deg);
-o-transform: rotate(-20deg);
transform: rotate(-20deg);
}
.back-logo {
position: absolute;
top: 40px;
left: 90px;
width: 160px;
height: 117px;
background: url(http://davidwalsh.name/demo/logo.png) 0 0 no-repeat;
}
.back-title {
font-weight: bold;
color: #00304a;
position: absolute;
top: 180px;
left: 0;
right: 0;
text-align: center;
text-shadow: 0.1em 0.1em 0.05em #acd7e5;
font-family: Courier;
font-size: 2em;
}
.back p {
position: absolute;
bottom: 40px;
left: 0;
right: 0;
text-align: center;
padding: 0 20px;
font-family: arial;
line-height: 2em;
}
I am trying to create a flip animation for some images, which when they turn over, display appropriate link text. This works perfectly in all browsers that I have tested, but IE11.
I read that there is a problem with transform-style: preserve-3d; for IE10, but as I am a CSS beginner, I have been unable to figure out a way to correct the coding.
Here is the HTML:
<div class="flipcontainer">
<div class="flipscene3D">
<div class="flip">
<div>
<p>
<a itemprop="url" href="ARC3RFC.html"><span itemprop="headline">ARC3RFC Essay: Tomb 100, Tomb U-J and Maadi South: Themes from Predynastic Egypt</span></a> - 2013
</p>
</div>
<div>
<img src="ARC3RFC.jpg" class="flipimg">
</div>
</div>
</div>
</div>
And the CSS:
img.flipimg {
height: 150px;
width: 150px;
/*border-radius*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.flipcontainer {
display: block;
width: 760px;
height: 700px;
margin: 30px auto;
}
.flipscene3D {
display: block;
float: left;
margin: 10px;
/*border-radius*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/*perspective*/
-webkit-perspective: 300px;
-moz-perspective: 300px;
-ms-perspective: 300px;
-o-perspective: 300px;
perspective: 300px;
}
.flip div {
position: absolute;
width: 150px;
height: 150px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
z-index: 500
}
.flip div:first-child {
font-size: 12px;
/*border-radius*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background: #333;
/*transform*/
-webkit-transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
transform: rotateX(180deg);
}
.flip div:first-child p {
color: #FFF;
text-shadow: 0 0 1px .111;
padding-top: 10px;
text-align: center;
}
.flip {
width: 150px;
height: 150px;
/*border-radius*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/*box-shadow*/
-webkit-box-shadow: 0 0 15px rgba(0,0,0,0.3);
-moz-box-shadow: 0 0 15px rgba(0,0,0,0.3);
box-shadow: 0 0 15px rgba(0,0,0,0.3);
/*transform*/
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
transform: rotateX(0deg);
/*transition*/
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
/*transform-style*/
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.flipscene3D:hover .flip {
/*transform*/
-webkit-transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
transform: rotateX(180deg);
}
Have a look at this Flipping animation Demo. I hope it will solve your problem.
Check the DEMO.
Here is the HTML code look like.
<div class="wrapper">
<div class="front anim">
Chrome
</div>
<div class="back anim">
IE
</div>
</div>
Here is the CSS code.
.wrapper {
width: 300px;
height: 300px;
margin: auto;
position: relative;
}
.anim {
width: 100%;
height: 100%;
-o-transition: all .5s;
-ms-transition: all .5s;
-moz-transition: all .5s;
-webkit-transition: all .5s;
transition: all .5s;
-webkit-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0px;
left: 0px;
}
.front {
z-index: 2;
background: url(http://lorempixel.com/300/300/) no-repeat;
}
.back {
z-index: 1;
-webkit-transform: rotateX(-180deg);
-ms-transform: rotateX(-180deg);
-moz-transform: rotateX(-180deg);
transform: rotateX(-180deg);
background: url(http://placehold.it/300x300) no-repeat;
}
.wrapper:hover .front {
z-index: 1;
-webkit-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
transform: rotateX(180deg);
}
.wrapper:hover .back {
z-index: 2;
-webkit-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
transform: rotateX(0deg);
}
.flipscene3D:hover .flip {
/*transform*/
-webkit-transform: rotateX(180deg);
-moz-transform: rotateX(180deg);
-ms-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
transform: rotateX(180deg);
filter: progid:DXImageTransform.Microsoft.Matrix(M11=-1,
M12=1.2246467991473532e-16,
M21=-1.2246467991473532e-16,
M22=-1,
SizingMethod='auto expand');
}