firefox rounded div get cropped while transition with overflow hidden to parent - html

I am just doing a simple scale on a rounded div, see the fiddle.
It works well on Chrome and Safari, but in Firefox a part of the rounded div get cropped during the transition and get back to normal after that.
It can be fixed:
with a non transparent background on the parent.
without the overflow: hidden of the parent.
without the rotation on the parent.
But i can't use this fixes for what I am making here.
All this stuff works in Chrome and Safari, so if anyone knows why firefox act like this i would be pleased to know.
Thanks
Here is the css :
.petale-wrapper
{
width: 200px;
height: 100px;
position: relative;
transform: rotate(-20deg);
overflow: hidden;
-webkit-transform: rotate(-20deg);
-moz-transform: rotate(-20deg);
}
.petale
{
position: absolute;
left: 50px;
top: 50px;
width: 150px;
height: 75px;
border-radius: 75px 75px 0 0;
background-color: cyan;
transition: transform 0.5s;
-webit-transition: -webkit-transform 0.5s;
-moz-transition: -moz-transform 0.5s;
transform: scale(1) rotate(60deg);
-webkit-transform: scale(1) rotate(60deg);
-moz-transform: scale(1) rotate(60deg);
}
.petale:hover
{
transform: scale(1.2) rotate(60deg);
-webkit-transform: scale(1.2) rotate(60deg);
-moz-transform: scale(1.2) rotate(60deg);
}
Here is the html:
<div class="petale-wrapper">
<div class="petale">
</div>
</div>

Related

CSS transform is not working in Edge

I am stuck at the following problem.
On this site that I created, I have a gallery which is located on the bottom of the page. If I hover over the thumbs, they fly around like crazy which is not what I want. It works like a charm on other browsers; only Microsoft Edge is affected.
Can someone help me out to get the images to behave as expected?
The CSS looks like this:
.node-gallery {
float: left;
width: 150px;
height: 150px;
position: relative;
margin: 0 60px 50px 0;
}
.node-gallery img {
position: absolute;
bottom: 0px;
}
.node-gallery .image1 {
left: 0px;
z-index: 3;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease
}
.node-gallery .image2 {
left: 7px;
height: 148px;
z-index: 2;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease
}
.node-gallery .image3 {
left: 14px;
height: 145px;
z-index: 1;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease
}
.image1, .image2, .image3 {
border: 5px solid #F3F3F3!important;
box-shadow: 1px 1px 2px #666;
-webkit-shadow: 1px 1px 2px #666;
-webkit-transform: rotate(0deg) translate(0px);
}
.node-gallery:hover .image1 {
z-index: 6;
-ms-transform: rotate(-5deg) translate(-20px, -2px);
-ms-transform-origin: center bottom;
-webkit-transform: rotate(-5deg) translate(-20px, 2px);
-webkit-transform-origin: center bottom;
-moz-transform: rotate(-5deg) translate(-20px, -2px);
-moz-transform-origin: center bottom;
-o-transform: rotate(-5deg) translate(-20px, -2px);
-o-transform-origin: center bottom;
}
.node-gallery:hover .image2 {
z-index: 5;
-ms-transform: rotate(-2deg) translate(0px, 2px);
-ms-transform-origin: center bottom;
-webkit-transform: rotate(-2deg) translate(0px, -2px);
-webkit-transform-origin: center bottom;
-moz-transform: rotate(-2deg) translate(0px, 2px);
-moz-transform-origin: center bottom;
-o-transform: rotate(-2deg) translate(0px, 2px);
-o-transform-origin: center bottom;
}
.node-gallery:hover .image3 {
z-index: 4;
-ms-transform: rotate(5deg) translate(20px, -2px);
-ms-transform-origin: center bottom;
-webkit-transform: rotate(5deg) translate(20px, 2px);
-webkit-transform-origin: center bottom;
-moz-transform: rotate(5deg) translate(20px, -2px);
-moz-transform-origin: center bottom;
-o-transform: rotate(5deg) translate(20px, -2px);
-o-transform-origin: center bottom;
}
Few months late on this, but I believe I just encountered this same bug and found a solution. It seems like Microsoft Edge 13 has a problem interpreting some normally acceptable values for transform-origin. Specifically for me, it was ignoring the value right center, but working fine with top left, leading me to believe the center value (which I see in your example code) might be the issue.
The fix for me was to use percentage values, so transform-origin: center bottom would become transform-origin: 50% 100%. Hope this helps anyone else who encounters this issue.
Note that despite the top-voted answer suggesting the ms- prefix, this question is about the recent MS Edge browser, and that prefix has not been required since Internet Explorer 9 for the transform property (per caniuse.com).
Ed. by another user: This answer does not apply to the Microsoft Edge browser.
You need to write the standard transition and transform properties, and then the -ms prefix for microsoft internet explorer:
.selector {
-webkit-transform: scale(); /* android, safari, chrome */
-moz-transform: scale(); /* old firefox */
-o-transform: scale(); /* old opera */
-ms-transform: scale(); /* old IE */
transform: scale(); /*standard */
}
The same in transition property. Your solution is to write the standard.
I found some differences:
When I try rotate (transform) element with display:inline, that not work in EDGE.
But, when I use display: inline-block then transform works.
Just try this (in MS EDGE):
<style>
#good span { display: inline-block; transform: rotate(-10deg); }
#bad span { transform: rotate(-10deg); }
</style>
<div id="good"><span>WELCOME</span></div>
<div id="bad"><span>WELCOME</span><div>
Try do to this,
Your gallery images using the fancybox API.SO there is option for change the animation types in fancybox.js.
Reference:http://fancybox.net/api
You need to go fancybox js file,find 'transitionIn, transitionOut' change to effect of The transition type. Can be set to 'elastic', 'fade' or 'none'.
According to the windows all browsers will be fine.

skew and change perspective of image and its border going from one direction to another

I would like to skew and change perspective of the image (height from top and bottom) going from one direction to another.I am not 100% sure if I am using right terminology but below example should explain what I am trying to achieve.
Example of the image with border:
Example* of how it should appear on my web page:
Or another example from reference question
This is what I have tried
Get the final image and use it as is but the problem is that the
image quality deteriorates when width is changed.
Bunch of css options http://jsfiddle.net/6ksayLx8/
/*Attempt 1*/
#box {
width: 200px;
height: 200px;
/*background-color:green;*/
position: relative;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
transition: all 200ms ease-in;
}
#box:after, #box:before {
display: block;
content:"\0020";
color: transparent;
width: 211px;
height: 45px;
background: white;
position: absolute;
left: 1px;
bottom: -20px;
-webkit-transform: rotate(-12deg);
-ms-transform: rotate(-12deg);
-o-transform: rotate(-12deg);
-moz-transform: rotate(-12deg);
transform: rotate(-12deg);
}
#box:before {
bottom: auto;
top: -20px;
-webkit-transform: rotate(12deg);
-ms-transform: rotate(12deg);
-o-transform: rotate(12deg);
-moz-transform: rotate(12deg);
transform: rotate(12deg);
}
/*Attempt 2*/
.skew {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
/* the magic ingredient */
-webkit-transform: skew(-16deg, 0);
-moz-transform: skew(-16deg, 0);
-ms-transform: skew(-16deg, 0);
-o-transform: skew(-16deg, 0);
transform: skew(-16deg, 0);
overflow: hidden;
width: 300px;
height: 260px;
position: relative;
left: 50px;
border: 1px solid #666;
}
.skew img {
-moz-transform: skew(16deg, 0);
-ms-transform: skew(16deg, 0);
-o-transform: skew(16deg, 0);
-webkit-transform: skew(16deg, 0);
transform: skew(16deg, 0);
position: relative;
left: -40px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-xs-6">
<div id="box">
<img src="http://placehold.it/560x366" class="img-responsive">
</div>
</div>
<div class="col-xs-6">
<div class="skew">
<img src="http://placehold.it/560x366" class="img-responsive">
</div>
</div>
</div>
</div>
Other details:
Website uses Bootstrap3 and so the solution should be responsive
Image must have border
I am fine not supporting anything less than IE 9
I have gone thru many links and different search terms in Google below are worthy to be mentioned:
CSS3 Transform Skew
CSS Skew only container, not content
CSS Transform maker
*Please discard the difference of color and scroll bar in this example image. This is just an example to explain outcome.
Today I stumbled upon this article https://viget.com/inspire/angled-edges-with-css-masks-and-transforms and it seems to do the task I was looking for (I already moved on with image solution but just pasting this here for others) and live example can be found on https://savingplaces.org/

Grainy button transform in firefox

I am trying to transform a button, but it is really grainy (During the transform) in firefox.
Can someone take a look, the code is below... and the js fiddle link is attached here https://jsfiddle.net/L3f9cy7g/1/
As I said. The issue is only in firefox, and I think it has something to do with anti-aliasing. We tried switching it to a 3d transform, and adjusting the z-index to prevent the firefox browser from messing with the animation. No luck so far.
<div class="closePop">
<p></p>
</div>
body{background:black;}
.closePop {
right: -5px;
top: -5px;
height: 28px;
background-color: #f68d1e;
color: white;
border-radius: 50%;
width: 29px;
text-align: center;
border-style: solid;
border-width: 2px;
vertical-align: middle;
cursor: pointer;
transform: rotate(0deg);
transition: all .3s ease-out;
}
.closePop p {
margin: 0;
margin-top: 4px;
}
.closePop:hover p:after {
content:':(';
transition:contentArea 3s ease-out rotate .3s ease-out;
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: translateZ(1px) rotate(0deg);
}
.closePop p:after {
content: 'X';
transition: all .3s ease-out;
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: translateZ(1px) rotate(90deg);
}
.closePop:hover {
border-radius: 0;
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: translateZ(1px) rotate(90deg);
}
.closePop p {
transition: contentArea .3s ease-out rotate .3s ease-out;
}
Try to add a transparent outline attribute,
outline: 1px solid transparent;

-webkit-transform and ignored z-index

On safari 5.1.7 for windows, some rotated elements are cutting through others elements:
While on other browsers Firefox, Chrome, IE I get:
Is there a way to avoid the 'cutting' issue on safari ?
A jsfiddle showing the issue here.
css:
.myFlip {
width: 310px;
margin: 20px auto;
-moz-perspective: 780px;
-webkit-perspective: 780px;
perspective: 780px;
}
.myFlip li {
position: relative;
display: inline-block;
width: 100px;
height: 100px;
margin-right: -70px;
}
.test1 {
background-color:green;
z-index: 30;
-moz-transform: rotateY(0deg) scale(1.2);
-webkit-transform: rotateY(0deg) scale(1.2);
transform: rotateY(0deg) scale(1.2);
}
.test2 {
background-color:black;
z-index: 10;
-moz-transform: rotateY(45deg);
-webkit-transform: rotateY(45deg);
transform: rotateY(45deg);
}
html:
<ul class="myFlip">
<li class="test1"></li>
<li class="test2"></li>
</ul>
In most cases, z-index does not apply to an element that does not have a 'position' attribute. Try this
For instance :
position:relative;
z-index: 10;
I don't have a Safari browser to test it in.
Found the following:
By using rotateY we are adding a new dimension to our 2D classic output.
In this browser z-index don't work in 3D.
There is however a way to solve my issue:
.test1 {
background-color:green;
z-index: 30;
-moz-transform: rotateY(0deg) scale(1.2);
-webkit-transform: rotateY(0deg) scale(1.2) translate3d(0, 0, 50px);
transform: rotateY(0deg) scale(1.2);
}
By applying translate3d to .test1 the green and the black block are no more on the same z plan.
test1 is on the z plan where z=50px ( without translate3d it was on z=0px )
test2 is an 'Oblique' plan somewhere bettween -50px<z<50px

Flipping two different images and stopping on hover

The idea is to create an infinite animation on CSS that will show two sides of a card spinning all the time and to stop the animation on hover, revealing only the front and increasing the size 20% with a link to another section.
I am able to flip and grow to the second image on hover, but I seem to be unable to replace the action on a Keyframe animation.
This is what I have so far:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.panel {
width: 300px;
height: 300px;
margin: auto;
position: relative;
}
.card {
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;
-webkit-animation: CardFlip 5s infinite;
}
.front {
position: absolute;
top: 0px;
left: 0px;
z-index: 2;
background-image: url('http://placehold.it/300x300/red');
}
.back {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
transform: rotateY(-180deg);
background-image: url('http://placehold.it/300x300/blue');
}
.panel:hover .front {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.panel:hover .back {
position: absolute;
top: 0px;
left: 0px;
z-index: 2;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
-webkit-transform: scale(1.2,1.2);
-ms-transform: scale(1.2,1.2);
-moz-transform: scale(1.2,1.2);
transform: scale(1.2,1.2);
}
#-webkit-keyframes CardFlip {
0% {
position: absolute;
top: 0px;
left: 0px;
z-index: 2;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
-webkit-transform: scale(1.2,1.2);
-ms-transform: scale(1.2,1.2);
-moz-transform: scale(1.2,1.2);
transform: scale(1.2,1.2);
}
100% {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
}
</style>
</head>
<body>
<br>
<br>
<div class="panel">
<div class="front card">
</div>
<div class="back card">
</div>
</div>
</body>
I think you need to add backface-visibility: hidden; only to front card.
If you need your animation to have infinite look, you have to have similar 0% and 100% points.
Also, you had missed transform-style: preserve-3d; property.
Also, I've added one more container to avoid animation on cards. I think it's more semantic.
Check out this fiddle: http://jsfiddle.net/nikoloza/2zrk7/
Update
If we add perspective: 1000 to the main container, we'll get real 3d effect. Fiddle: http://jsfiddle.net/nikoloza/2zrk7/1/
Update 2
And if we need only left-to-right flipping we can set 360deg instead of 0deg into 100% point in the animation. Fiddle: http://jsfiddle.net/nikoloza/2zrk7/2/