This is my CSS for a concept I'm working on...
It displays the picture, and once you hover over the card it flips it. The problem I'm having is that it isn't working on SOME computers. Oddly enough, it doesn't work on one of my computers. It's windows XP. It doesn't work in any of the modern browsers. Another computer experienced it running OSX 10.5, and chrome. The problem being, you only see the backwards text of the , then if flip to the normal view.
.sleeve {
float: left;
margin: 5px;
width: 240px; height: 340px;
perspective: 1000px;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
}
.card {
width: 240px;
height: 340px;
transform-style: preserve-3d;
transition: all 0.5s ease-in;
-webkit-transform-style: preserve-3d;
-webkit-transition: all 0.5s ease-in;
-moz-transform-style: preserve-3d;
-moz-transition: all 0.5s ease-in;
-o-transform-style: preserve-3d;
-o-transition: all 0.5s ease-in;
}
.sleeve:hover .card {
transform: rotateY(180deg);
box-shadow: -5px 5px 5px #333333;
-webkit-transform: rotateY(180deg);
-webkit-box-shadow: -5px 5px 5px #333333;
-moz-transform: rotateY(180deg);
-moz-box-shadow: -5px 5px 5px #333333;
-o-transform: rotateY(180deg);
-o-box-shadow: -5px 5px 5px #333333;
}
.face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
}
.face.front img {
height: 340px;
width: 240px;
}
.face.back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
-webkit-transform: rotateY(180deg);
-webkit-box-sizing: border-box;
-moz-transform: rotateY(180deg);
-moz-box-sizing: border-box;
-o-transform: rotateY(180deg);
-o-box-sizing: border-box;
border: 5px solid #000000;
padding: 5px 0 0 10px;
height: 340px;
width: 240px;
overflow: auto;
color: black;
text-align: left;
background-color: #FFFFFF;
}
If I add:
.face.front {
z-index=10;
}
It shows the picture, but when it flips, the image is just backwards.
Related
I've created a webpage based around this pen:
https://codepen.io/onediv/pen/JGmgK (not sure how much help the code here is but I've been told to copy and paste it!)
#lab {
width: 1000px;
overflow: hidden;
padding-bottom: 70px;
position: relative;
margin: 0 auto;
margin-bottom: 2.5em;
background: rgb(236, 236, 236);
-webkit-transition: all ease 500ms;
-moz-transition: all ease 500ms;
-o-transition: all ease 500ms;
-ms-transition: all ease 500ms;
transition: all ease 500ms;
}
h1 {
font-family: bebas_neueregular ,sans-serif;
font-size: 1.75em;
padding: 0.2em 0 0.2em 0.2em;
color: white;
text-shadow: 0 0.06em 0 #424242;
position: relative;
}
#lab h1 {
background: #B0DAD4;
}
.beaker {
-webkit-filter: drop-shadow(#424242 0px 1px 0px);
border-bottom: 2em solid #FFF;
border-left: 1em solid transparent;
border-right: 1em solid transparent;
border-radius: .5em;
height: 0;
width: 1em;
position: absolute;
right: 0.7em;
bottom: 22%;
font-size: 0.6em;
}
.beaker::before {
border-left: .25em solid #FFF;
border-radius: .25em;
border-right: .25em solid #FFF;
content: '';
height: .25em;
left: -.25em;
position: absolute;
top: -1em;
width: 1em;
}
.beaker::after {
border-left: .25em solid #FFF;
border-right: .25em solid #FFF;
content: '';
height: 1em;
left: 0;
position: absolute;
top: -1em;
width: .5em;
}
.sectionheader {
position: relative;
}
.lab_item {
width: 200px;
height: 230px;
position: relative;
display: inline-block;
}
.hexagon2 {
position: absolute;
width: 200px;
height: 400px;
top: -85px;
}
.hexagon {
overflow: hidden;
visibility: hidden;
-webkit-transform: rotate(120deg);
-moz-transform: rotate(120deg);
-o-transform: rotate(120deg);
-ms-transform: rotate(120deg);
transform: rotate(120deg);
cursor: pointer;
}
.hexagon-in1 {
overflow: hidden;
width: 100%;
height: 100%;
-webkit-transform: rotate(-60deg);
-moz-transform: rotate(-60deg);
-o-transform: rotate(-60deg);
-ms-transform: rotate(-60deg);
transform: rotate(-60deg);
}
.hexagon-in2 {
-webkit-box-shadow: inset 0 0 0 200px rgba(176, 218, 212, 0.48);
box-shadow: inset 0 0 0 200px rgba(176, 218, 212, 0.48);
overflow: hidden;
width: 100%;
height: 100%;
background-repeat: no-repeat;
background-position: 50%;
-webkit-background-size: 125%;
-moz-background-size: 125%;
background-size: 125%;
visibility: visible;
-webkit-transform: rotate(-60deg);
-moz-transform: rotate(-60deg);
-o-transform: rotate(-60deg);
-ms-transform: rotate(-60deg);
transform: rotate(-60deg);
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.hexagon-in2:hover {
-webkit-box-shadow: inset 0 0 0 0px #B0DAD4;
box-shadow: inset 0 0 0 0px #B0DAD4;
}
#lab article {
padding-top: 1em;
width: 820px;
margin: 0 auto;
}
.lab_item:nth-child(7n-2) {
margin-left: 101px;
}
.lab_item:nth-child(n+5) {
margin-top: -55px;
}
#media (max-width: 1015px) {
#lab {
width: 100%;
}
}
#media (max-width: 820px) {
.lab_item:nth-child(5n-1) {
margin-left: 102px;
}
.lab_item:nth-child(n+4) {
margin-top: -62px;
}
.lab_item:nth-child(7n-2) {
margin-left: 0px;
}
.lab_item:nth-child(n+5) {
margin-top: -56px;
}
#lab article {
width: 610px;
}
}
#media (max-width: 640px) {
#lab article {
width: 405px;
}
.lab_item:nth-child(5n-1) {
margin-left: 0px;
}
.lab_item:nth-child(3n) {
margin-left: 102px;
}
.lab_item:nth-child(n+3) {
margin-top: -56px;
}
}
#media (max-width: 450px) {
#lab article {
width: 300px;
}
.lab_item:nth-child(3n) {
margin-left: 0px;
}
.lab_item:nth-child(2n) {
margin-left: 102px;
}
.lab_item:nth-child(n+2) {
margin-top: -56px;
}
}
It all looks great except on IE, where the hover state for the next row of hexagons starts well within the content of the first row of hexagons. It presumably hovers over the full extent of the hexagon content even though it isn't visible. Same problem exists for this pen: https://codepen.io/web-tiki/pen/HhCyd
Can anyone help solve this hover issue? Would it be possible to solve by z-indexing the respective hexagons so each sits on top of the other, or is there an IE-specific solution? It works perfectly on Chrome and FireFox.
This is my structure:
<div class="parent">
<a href="#">
<p class="carousel_img">
<span class="img"></span>
Some text
</p>
</a>
and this is my style:
.parent{
height: 270px;
width: 270px;
}
.img {
background-image: url(http://frontendtest.ru/anit/img/ps_3.jpg);
background-size: cover;
display: block;
height: 250px;
overflow: hidden;
border-radius: 50%;
-webkit-transform: scale(1.3);
-ms-transform: scale(1.3);
transform: scale(1.3);
-webkit-transition: -webkit-transform 0.3s;
transition: -webkit-transform 0.3s;
transition: transform 0.3s;
transition: transform 0.3s, -webkit-transform 0.3s;
background-repeat: no-repeat;
}
.carousel_img {
border-radius: 50%;
border: 4px solid #f6e9d6;
height: 260px;
width: 260px;
overflow: hidden;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
position: relative;
margin: 0 auto;
}
a:hover .carousel_img {
border-color: #2e8ce4;
}
.carousel_img:before {
height: 15px;
width: 15px;
border-left: 2px solid #fff;
border-bottom: 2px solid #fff;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
margin: auto;
bottom: 20px;
z-index: 2;
}
.carousel_img:after {
content: '';
position: absolute;
left: 0;
right: 0;
display: none;
}
.carousel_img:after {
bottom: 0;
height: 56px;
background: #2e8ce4;
}
a:hover .carousel_img:before, a:hover .carousel_img:after {
display: block;
}
In Chrome, Firefox, Edge we can see a thin white line between blue :after element and blue border on bottom of picture when we :hover on image. This is a link on my pen http://codepen.io/DmitryShutov/pen/JKovYb.
How can I remove thin white line?
I have code that works perfectly fine on Chrome, Opera and Safari but not on Mozilla. I have included a working fiddle to visualize the problem. I have tried changing the size, changing the angle of rotation, visibility, etc., and still I have not been able to solve the problem.
Html :
<section class='in-circle'>
<div class='card onhover'>
<div class='front'>
<label id='image'></label>
</div>
<div class='back'>
<a href='./lessons.php'>Schedules</a>
</div>
</div>
</section>
CSS:
.in-circle{
width: 125px;
height: 125px;
display: table;
position: relative;
border: 2px solid #FFFFFF;
font-family: 'Handlee', cursive;
-webkit-border-radius: 100% 100%;
-moz-border-radius: 100% 100%;
border-radius: 100% 100%;
-webkit-transition: opacity 1.75s ease-in-out;
-moz-transition: opacity 1.75s ease-in-out;
-ms-transition: opacity 1.75s ease-in-out;
-o-transition: opacity 1.75s ease-in-out;
transition: opacity 1.75s ease-in-out;
}
.card {
-webkit-perspective: 800;
perspective: 800;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
transition: 0.5s;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.card.onhover:hover{
-webkit-transform: rotateY(-540deg);
-moz-transform: rotateY(-540deg);
transform: rotateY(-540deg);
}
.card.onclick{
-webkit-transform: rotateY(-540deg);
-moz-transform: rotateY(-540deg);
transform: rotateY(-540deg);
}
.card .front {
width: inherit;
height: inherit;
cursor: pointer;
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
z-index: 1;
}
.card .back {
width: inherit;
height: inherit;
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform: rotateY(-540deg);
transform: rotateY(-540deg);
}
.in-circle > .card{
width: inherit;
height: inherit;
display: block;
position: relative;
}
.in-circle > .card > .front,
.in-circle > .card > .back{
display: table;
text-align: center;
-webkit-border-radius: 100% 100%;
-moz-border-radius: 100% 100%;
border-radius: 100% 100%;
background: rgba(255, 255, 255, 0.5);
}
.in-circle > .card > .front > *,
.in-circle > .card > .back > *{
display: table-cell;
vertical-align: middle;
}
.in-circle > .card > .back > a{
color: #FF0000;
}
.in-circle > .card > .front #image{
background-image: url('http://s30.postimg.org/4o23rf7bx/camera.png');
}
http://jsfiddle.net/gacci/mvct15gh/
Backface-visibility doesnt work properly in Mozilla.
Try to add this code in your css (it works for me):
.card {
backface-visibility: hidden;
}
With this, you are adding the backface-visibilityin the container too.
Ref: Backface-Visibility Not Working Properly in Firefox (Works in Safari)
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'm building a personal website and in the header section(i.e div) i've a logo for which i'm trying to add flip animation on hover, to show the content written back of the logo. Need a help in fixing the problem with browser Chrome as well as IE11. Works fine with Mozilla.
<div id="logo">
<div id="logo_card" class="shadow">
<div class="front face">
<img src="./images/logo+.jpg" />
</div>
<div class="back face center">
<p>Sooner the logo will be changed</p>
</div>
</div>
CSS for animation:
#logo{
width:450px;
height:150px;
margin-left:300px;
border-radius: 5px;
z-index: 1;
}
#logo {
perspective: 1000;
}
#logo_card {
width: 100%;
height: 100%;
transform-style: preserve-3d;
-moz-transition: all 1s linear;
-o-transition: all 1s linear;
-webkit-transition: all 1s linear;
transition: all 1s linear;
border-radius: 5px;
}
#logo:hover #logo_card {
-moz-transform: rotatey(180deg);
-ms-transform: rotatey(180deg);
-o-transform: rotatey(180deg);
-webkit-transform: rotatey(180deg);
transform: rotatey(180deg);
-moz-box-shadow: -5px 5px 5px #aaa;
-webkit-box-shadow: -5px 5px 5px #aaa;
box-shadow: 0 2px 5px rgba(0,0,0,0.25), 0 0 50px rgba(0,0,0,0.1) inset;
border-radius: 5px;
}
.face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
border-radius: 5px;
}
.face.back {
display: block;
-moz-transform: rotatey(180deg);
-ms-transform: rotatey(180deg);
-o-transform: rotatey(180deg);
-webkit-transform: rotatey(180deg);
transform: rotatey(180deg);
-moz-box-sizing: border-box;
box-sizing: border-box;
/*padding: 10px;*/
color: white;
text-align: center;
background-color: transparent;
border-radius: 5px;
font-size:20px;
font-family: 'Helvetica Neue',Helvetica,arial,sans-serif;
}
Greately this works fine with Mozilla firefox browser only :(
Thank you,