Image doesn't flip with css - html

When I apply the class prev it doesn't flip the image.
I'm kinda stuck on why it does not work, I tried it with Chrome, Firefox and IE and none of them work.
.pbtn {
background-image: url('../../images/linkpil.png');
background-repeat: no-repeat;
display: inline-block;
float: left;
background-position: center center;
&.first {
display: none;
}
&.next {
background-color: #C9E2E5;
}
.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
a {
overflow: hidden;
text-indent: -9999px; //hide text
height: 15px;
width: 15px;
display: inline-block;
}
}
<div class="pbtn">
</div>

From your less code, it looks like your html has to be this.
<div class="pbtn next">
</div>
<div class="pbtn prev">
</div>
and replace
&.next {
background-color: #C9E2E5;
}
.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
With:
&.next {
background-color: #C9E2E5;
}
&.prev {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}

Your css will do nothing because there is nothing in a to transform.
The background image is on the parent, and there is no content or image in the a. For all we know the transform is working fine but we can't see anything.

Related

How to rotate background-image in css?

I have a background image with a style called north:
.north {
background-image: url("./images/turtle-north.png");
background-repeat: no-repeat;
background-size: 50px 50px;
}
This is part of a reactjs component that renders a grid. The image displays fine with this rule. However when I try to rotate it with this rule:
.rotate_ninety {
-moz-transform: rotate(90deg) translateX(150px);
-webkit-transform: rotate(90deg) translateX(150px);
-o-transform: rotate(90deg) translateX(150px);
-ms-transform: rotate(90deg) translateX(150px);
transform: rotate(90deg) translateX(150px);
}
The img is pushed down ie not at the top left position in the grid anymore. How can I rotate the image and keep this position?
"The img is pushed down ie not at the top left position in the grid anymore"
It's because you're using translateX, if you want just to rotate the image, don't move it, use only transform: rotate:
* {
padding: 0;
margin: 0;
}
.rotate_ninety {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
<img src="https://www.w3schools.com/angular/pic_angular.jpg" class="rotate_ninety">

CSS3 Pie and rotating Images

I've been looking this CSS3 Pie.
https://codepen.io/anon/pen/gxQarR
HTML
<div class="pie big" data-start="270" data-value="360"></div>
<div class="pie" data-start="0" data-value="90"></div>
<div class="pie" data-start="90" data-value="180">2</div>
<div class="pie" data-start="180" data-value="90">3</div>
<div class="pie" data-start="180" data-value="270">4</div>
CSS
/*
make each pie piece a rectangle twice as high as it is wide.
move the transform origin to the middle of the left side.
Also ensure that overflow is set to hidden.
*/
.pie {
position:absolute;
width:400px;
height:800px;
overflow:hidden;
left:600px;
-moz-transform-origin:left center;
-ms-transform-origin:left center;
-o-transform-origin:left center;
-webkit-transform-origin:left center;
transform-origin:left center;
}
/*
unless the piece represents more than 50% of the whole chart.
then make it a square, and ensure the transform origin is
back in the center.
NOTE: since this is only ever a single piece, you could
move this to a piece specific rule and remove the extra class
*/
.pie.big {
width:800px;
height:800px;
left:50px;
-moz-transform-origin:center center;
-ms-transform-origin:center center;
-o-transform-origin:center center;
-webkit-transform-origin:center center;
transform-origin:center center;
}
/*
this is the actual visible part of the pie.
Give it the same dimensions as the regular piece.
Use border radius make it a half circle.
move transform origin to the middle of the right side.
Push it out to the left of the containing box.
*/
.pie:BEFORE {
content:"";
position:absolute;
width:400px;
height:800px;
left:-400px;
border-radius:400px 0 0 400px;
-moz-transform-origin:right center;
-ms-transform-origin:right center;
-o-transform-origin:right center;
-webkit-transform-origin:right center;
transform-origin:right center;
}
/* if it's part of a big piece, bring it back into the square */
.pie.big:BEFORE {
left:0px;
}
/*
big pieces will also need a second semicircle, pointed in the
opposite direction to hide the first part behind.
*/
.pie.big:AFTER {
content:"";
position:absolute;
width:200px;
height:400px;
left:200px;
border-radius:0 100px 100px 0;
}
/*
add colour to each piece.
*/
.pie:nth-of-type(1):BEFORE,
.pie:nth-of-type(1):AFTER {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
-ms-transform: rotate(360deg); /* IE 9 */
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
}
.pie:nth-of-type(2):AFTER,
.pie:nth-of-type(2):BEFORE {
background-color:green;
}
.pie:nth-of-type(3):AFTER,
.pie:nth-of-type(3):BEFORE {
background-color:red;
}
.pie:nth-of-type(4):AFTER,
.pie:nth-of-type(4):BEFORE {
background-color:orange;
}
/*
now rotate each piece based on their cumulative starting
position
*/
.pie[data-start="0"] {
-moz-transform: rotate(0deg); /* Firefox */
-ms-transform: rotate(0deg); /* IE */
-webkit-transform: rotate(0deg); /* Safari and Chrome */
-o-transform: rotate(0deg); /* Opera */
transform:rotate(0deg);
}
.pie[data-start="90"] {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform:rotate(90deg);
}
.pie[data-start="180"] {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform:rotate(180deg);
}
.pie[data-start="270"] {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform:rotate(270deg);
}
.pie[data-start="360"] {
-moz-transform: rotate(360deg); /* Firefox */
-ms-transform: rotate(360deg); /* IE */
-webkit-transform: rotate(360deg); /* Safari and Chrome */
-o-transform: rotate(360deg); /* Opera */
transform:rotate(360deg);
}
/*
and rotate the amount of the pie that's showing.
NOTE: add an extra degree to all but the final piece,
to fill in unsightly gaps.
*/
.pie[data-value="90"]:BEFORE {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform:rotate(90deg);
}
.pie[data-value="180"]:BEFORE {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform:rotate(180deg);
}
.pie[data-value="270"]:BEFORE {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform:rotate(270deg);
}
.pie[data-value="360"]:BEFORE {
-moz-transform: rotate(360deg); /* Firefox */
-ms-transform: rotate(360deg); /* IE */
-webkit-transform: rotate(360deg); /* Safari and Chrome */
-o-transform: rotate(360deg); /* Opera */
transform:rotate(360deg);
}
/*
NOTE: you could also apply custom classes (i.e. .s0 .v30)
but if the CSS3 attr() function proposal ever gets implemented,
then all the above custom piece rules could be replaced with
the following:
.pie[data-start] {
transform:rotate(attr(data-start,deg,0);
}
.pie[data-value]:BEFORE {
transform:rotate(attr(data-value,deg,0);
}
*/
I am attepmting to create this pie, with pictures in each 90* peice.
Yet I have had no luck rotating the picture, so it looks proper.
I've attepmted to take usage of the transform rotate, yet with no luck.
I thought of rotating the picture in Photoshop, so it'd fit. Are there any other ways to do it?
why don't you try something like this codepen.io
<div class="wrapper">
<div class="box box-1"></div>
<div class="box box-2"></div>
<div class="box box-3"></div>
<div class="box box-4"></div>
</div>
<style>
.wrapper {
width:800px;
}
.box {
float: left;
display:inline-block;
width: 400px;
height:400px;
background-color:#000;
}
.box + .box + .box {
margin-top:-4px;
}
.box-1 {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
border-top-left-radius:100%;
}
.box-2 {
background: url(http://media.rtl.fr/cache/kfnpEy__8SYEunR6sbHTZg/2000v1333-0/online/image/2017/0331/7787896201_le-masque-insecte-d-une-grenouille.jpg) no-repeat;
border-top-right-radius:100%;
}
.box-3 {
background: url(https://cdn.pixabay.com/photo/2016/06/18/17/42/image-1465348_960_720.jpg) no-repeat;
border-bottom-left-radius:100%;
}
.box-4 {
background: url(https://cdn.pixabay.com/photo/2017/04/05/11/56/image-in-the-image-2204798_960_720.jpg) no-repeat;
border-bottom-right-radius:100%;
}
</style>
One option would be that you add a new element inside the pie piece that you can control independently of the overall piece, and put the background image on that inner element.
<div class="pie" data-start="0" data-value="90">
<div class="pie background"></div>
</div>
<div class="pie" data-start="90" data-value="180">2</div>
<div class="pie" data-start="180" data-value="90">3</div>
<div class="pie" data-start="180" data-value="270">4</div>
(Note how I also removed the extra pie piece you had. It was unnecessary for this example.)
Then in your CSS, this:
.pie:nth-of-type(1):BEFORE,
.pie:nth-of-type(1):AFTER {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
-ms-transform: rotate(360deg); /* IE 9 */
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
}
Becomes:
.pie.background:BEFORE,
.pie.background:AFTER {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
-ms-transform: rotate(360deg); /* IE 9 */
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
}
And you can add:
.pie.background {
left: 0;
}
.pie.background::before {
left: 0;
transform-origin: initial;
border-radius: 0 400px 400px 0;
}
.pie {
position: absolute;
width: 400px;
height: 800px;
overflow: hidden;
left: 600px;
-moz-transform-origin: left center;
-ms-transform-origin: left center;
-o-transform-origin: left center;
-webkit-transform-origin: left center;
transform-origin: left center;
}
.pie.background {
left: 0;
}
.pie.background::before {
left: 0;
transform-origin: initial;
border-radius: 0 400px 400px 0;
}
.pie.background:BEFORE,
.pie.background:AFTER {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
-ms-transform: rotate(360deg); /* IE 9 */
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
}
.pie:BEFORE {
content: "";
position: absolute;
width: 400px;
height: 800px;
left: -400px;
border-radius: 400px 0 0 400px;
-moz-transform-origin: right center;
-ms-transform-origin: right center;
-o-transform-origin: right center;
-webkit-transform-origin: right center;
transform-origin: right center;
}
.pie:nth-of-type(2):AFTER,
.pie:nth-of-type(2):BEFORE {
background-color: green;
}
.pie:nth-of-type(3):AFTER,
.pie:nth-of-type(3):BEFORE {
background-color: red;
}
.pie:nth-of-type(4):AFTER,
.pie:nth-of-type(4):BEFORE {
background-color: orange;
}
.pie[data-start="0"] {
-moz-transform: rotate(0deg); /* Firefox */
-ms-transform: rotate(0deg); /* IE */
-webkit-transform: rotate(0deg); /* Safari and Chrome */
-o-transform: rotate(0deg); /* Opera */
transform: rotate(0deg);
}
.pie[data-start="90"] {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform: rotate(90deg);
}
.pie[data-start="180"] {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform: rotate(180deg);
}
.pie[data-start="270"] {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform: rotate(270deg);
}
.pie[data-value="90"]:BEFORE {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform: rotate(90deg);
}
.pie[data-value="180"]:BEFORE {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform: rotate(180deg);
}
.pie[data-value="270"]:BEFORE {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform: rotate(270deg);
}
<div class="pie" data-start="0" data-value="90">
<div class="pie background"></div>
</div>
<div class="pie" data-start="90" data-value="180">2</div>
<div class="pie" data-start="180" data-value="90">3</div>
<div class="pie" data-start="180" data-value="270">4</div>
hope this helps
/*
make each pie piece a rectangle twice as high as it is wide.
move the transform origin to the middle of the left side.
Also ensure that overflow is set to hidden.
*/
.pie {
position:absolute;
width:400px;
height:800px;
overflow:hidden;
left:600px;
-moz-transform-origin:left center;
-ms-transform-origin:left center;
-o-transform-origin:left center;
-webkit-transform-origin:left center;
transform-origin:left center;
}
/*
unless the piece represents more than 50% of the whole chart.
then make it a square, and ensure the transform origin is
back in the center.
NOTE: since this is only ever a single piece, you could
move this to a piece specific rule and remove the extra class
*/
.pie.big {
width:800px;
height:800px;
left:50px;
-moz-transform-origin:center center;
-ms-transform-origin:center center;
-o-transform-origin:center center;
-webkit-transform-origin:center center;
transform-origin:center center;
}
/*
this is the actual visible part of the pie.
Give it the same dimensions as the regular piece.
Use border radius make it a half circle.
move transform origin to the middle of the right side.
Push it out to the left of the containing box.
*/
.pie:BEFORE {
content:"";
position:absolute;
width:400px;
height:800px;
left:-400px;
border-radius:400px 0 0 400px;
-moz-transform-origin:right center;
-ms-transform-origin:right center;
-o-transform-origin:right center;
-webkit-transform-origin:right center;
transform-origin:right center;
}
/* if it's part of a big piece, bring it back into the square */
.pie.big:BEFORE {
left:0px;
}
/*
big pieces will also need a second semicircle, pointed in the
opposite direction to hide the first part behind.
*/
.pie.big:AFTER {
content:"";
position:absolute;
width:200px;
height:400px;
left:200px;
border-radius:0 100px 100px 0;
}
/*
add colour to each piece.
*/
.pie:nth-of-type(1):BEFORE,
.pie:nth-of-type(1):AFTER {
background: url(http://takeawayshop.dk/image/frontpage/pizza-1471406_960_720.jpg) no-repeat;
-ms-transform: rotate(360deg); /* IE 9 */
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
}
.pie:nth-of-type(2):AFTER,
.pie:nth-of-type(2):BEFORE {
background-color:green;
}
.pie:nth-of-type(3):AFTER,
.pie:nth-of-type(3):BEFORE {
background-color:red;
}
.pie:nth-of-type(4):AFTER,
.pie:nth-of-type(4):BEFORE {
background-color:orange;
}
/*
now rotate each piece based on their cumulative starting
position
*/
.pie[data-start="0"] {
-moz-transform: rotate(0deg); /* Firefox */
-ms-transform: rotate(0deg); /* IE */
-webkit-transform: rotate(0deg); /* Safari and Chrome */
-o-transform: rotate(0deg); /* Opera */
transform:rotate(0deg);
}
.pie[data-start="90"] {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform:rotate(90deg);
}
.pie[data-start="180"] {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform:rotate(180deg);
}
.pie[data-start="270"] {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform:rotate(270deg);
}
.pie[data-start="360"] {
-moz-transform: rotate(360deg); /* Firefox */
-ms-transform: rotate(360deg); /* IE */
-webkit-transform: rotate(360deg); /* Safari and Chrome */
-o-transform: rotate(360deg); /* Opera */
transform:rotate(360deg);
}
/*
and rotate the amount of the pie that's showing.
NOTE: add an extra degree to all but the final piece,
to fill in unsightly gaps.
*/
.pie[data-value="90"]:BEFORE {
-moz-transform: rotate(90deg); /* Firefox */
-ms-transform: rotate(90deg); /* IE */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-o-transform: rotate(90deg); /* Opera */
transform:rotate(90deg);
}
.pie[data-value="180"]:BEFORE {
-moz-transform: rotate(180deg); /* Firefox */
-ms-transform: rotate(180deg); /* IE */
-webkit-transform: rotate(180deg); /* Safari and Chrome */
-o-transform: rotate(180deg); /* Opera */
transform:rotate(180deg);
}
.pie[data-value="270"]:BEFORE {
-moz-transform: rotate(270deg); /* Firefox */
-ms-transform: rotate(270deg); /* IE */
-webkit-transform: rotate(270deg); /* Safari and Chrome */
-o-transform: rotate(270deg); /* Opera */
transform:rotate(270deg);
}
.pie[data-value="360"]:BEFORE {
-moz-transform: rotate(360deg); /* Firefox */
-ms-transform: rotate(360deg); /* IE */
-webkit-transform: rotate(360deg); /* Safari and Chrome */
-o-transform: rotate(360deg); /* Opera */
transform:rotate(360deg);
}
/*
NOTE: you could also apply custom classes (i.e. .s0 .v30)
but if the CSS3 attr() function proposal ever gets implemented,
then all the above custom piece rules could be replaced with
the following:
.pie[data-start] {
transform:rotate(attr(data-start,deg,0);
}
.pie[data-value]:BEFORE {
transform:rotate(attr(data-value,deg,0);
}
*/
.pie:nth-of-type(2):BEFORE, .pie:nth-of-type(2):AFTER {
background: url(https://dummyimage.com/600x400/eb0707/fff) no-repeat;
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.pie:nth-of-type(3):BEFORE, .pie:nth-of-type(3):AFTER {
background: url(https://dummyimage.com/600x400/e7fa14/fff) no-repeat;
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.pie:nth-of-type(4):BEFORE, .pie:nth-of-type(4):AFTER {
background: url(https://dummyimage.com/600x400/9a05eb/fff) no-repeat;
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.pie[data-start="270"] {
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
}
<div class="pie" data-start="0" data-value="90"></div>
<div class="pie" data-start="90" data-value="180">2</div>
<div class="pie" data-start="180" data-value="90">3</div>
<div class="pie" data-start="270" data-value="270">4</div>

Image/Link is stuck to top-left, even when position is changed

This is my CSS and HTML.
div.musiclink {
position: relative;
}
a.music {
width: 258px;
height: 117px;
display: block;
background: deepskyblue url('MUSIC-cursive.png') center top no-repeat;
-webkit-transform: rotate(330deg);
-moz-transform: rotate(330deg);
-ms-transform: rotate(330deg);
-o-transform: rotate(330deg);
transform: rotate(330deg);
}
a.music:hover {
background-image: url('MUSIC-cursive-hover.png');
}
a.store {
position: relative;
left: 500px;
top: 100px;
width: 220px;
height: 110px;
display: block;
background: deeppink url('STORE-cursive.png') center top no-repeat;
-webkit-transform: rotate(30deg);
-moz-transform: rotate(30deg);
-ms-transform: rotate(30deg);
-o-transform: rotate(30deg);
transform: rotate(30deg);
}
a.store:hover {
background-image: url('STORE-cursive-hover.png');
}
<div class="musiclink">
</div>
<div class="storelink">
</div>
The thing is I positioned everything successfully when I used images instead of href links, but now nothing is working the way I want it to. I don't want the images/links to move when I resize the browser.

CSS animation:How to make the image object bounce back seamlessly?

Demo:
http://www.suanle.lol/move.php
In the animation demo you can see that when the egg just at the point of bouncing back, it flashes out for a second then flashed in. This makes the animation broken. So I wondered why this is happening and how I could fix it?
If you want to check the Gif:
Actually not just limited to the .gif, the problem occurs for any format of picture.
code is below:
#egg {
z-index: 2;
margin-left: 50px;
/*display: none;*/
position: absolute;
animation-duration: 6.4s;
animation-name: slide;
animation-iteration-count: infinite;
/*animation: pulse 5s infinite;*/
}
#keyframes slide {
0% {
margin-left: 10px;
/*width: 300%; */
}
49% {
-moz-transform: scaleX(1);
-o-transform: scaleX(1);
-webkit-transform: scaleX(1);
transform: scaleX(1);
filter: FlipH;
-ms-filter: "FlipH";
}
50% {
margin-left: 350px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
100% {
margin-left: 10px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
<img id="egg" src="http://i.stack.imgur.com/Ke7wO.gif">
Ok , This looks much better, changed 49% to 49.9% and it enhanced it a bit, the problem was this 1% of the 6.4s duration of animation is still noticeable which makes it "flashes".
by reducing this difference from 1% to 0.1% the period needed to transform from scaleX(1) to scaleX(-1) is not noticeable
jsFiddle
#container {
position: absolute;
background-color: rgb(231, 143, 128);
width: 310px;
height: 42px;
margin-left: 50px;
z-index: 1;
}
#egg {
z-index: 2;
margin-left: 50px;
/*display: none;*/
position: absolute;
animation-duration: 6.4s;
animation-name: slide;
animation-iteration-count: infinite;
/*animation: pulse 5s infinite;*/
}
#keyframes slide {
0% {
margin-left: 10px;
/*width: 300%; */
}
49.9% {
-moz-transform: scaleX(1);
-o-transform: scaleX(1);
-webkit-transform: scaleX(1);
transform: scaleX(1);
filter: FlipH;
-ms-filter: "FlipH";
}
50% {
margin-left: 350px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
100% {
margin-left: 10px;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
<img id="egg" src="http://i.stack.imgur.com/Ke7wO.gif">

CSS Animation Not Working in Firefox

This has really been killing me, not sure what the issue is because I have all the -moz- options.
Animation works fine in webkit but not Firefox.
Here's my CSS:
#-webkit-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#keyframes flip {
0% {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
100% {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
.jig-loaded img {
-webkit-animation: flip 1.0s !important;
animation: flip 1.0s !important;
-moz-animation: flip 10.0s !important;
}
Thanks so much!
#user3154772: As per my understanding. I have resolve below code.Please check and try it.
#-webkit-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#-moz-keyframes flip {
from {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
to {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
#keyframes flip {
0% {
-moz-transform: scaleX(0);
-o-transform: scaleX(0);
-webkit-transform: scaleX(0);
transform: scaleX(0);
}
100% {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
}
.jig-loaded img {
-webkit-animation: flip 1.0s !important;
animation: flip 1.0s !important;
-moz-animation: flip 10.0s !important;
}