I have created a simple loader using css. Is's working fine in other browsers but its fluctuating in IE 11 / Edge.
Here I have one loader div in html:
<div class="loader"> </div>
Here is my css for loader:
body{
background:black;
}
.loader {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 80px;
height: 80px;
-webkit-animation: spin 2s linear infinite; /* Safari 4+ */
-moz-animation: spin 2s linear infinite; /* Fx 5+ */
-o-animation: spin 2s linear infinite; /* Opera 12+ */
animation: spin 2s linear infinite;
}
#-moz-keyframes spin {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
#-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#keyframes spin {
from {transform:rotate(0deg);}
to {transform:rotate(360deg);}
}
Here is fiddle:
Fiddle
Try this
body{
background:black;
}
.loader {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 80px;
height: 80px;
-webkit-animation: spin 2s linear infinite; /* Safari 4+ */
-moz-animation: spin 2s linear infinite; /* Fx 5+ */
-o-animation: spin 2s linear infinite; /* Opera 12+ */
-ms-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
#keyframes spin{
0% {transform:rotateZ(0deg);}
100%{transform:rotateZ(360deg);}
}
#-webkit-keyframes spin{
0% {transform:rotateZ(0deg);}
100%{transform:rotateZ(360deg);}
}
#-moz-keyframes spin{
0% {transform:rotateZ(0deg);}
100% {transform:rotateZ(360deg);}
}
#-ms-keyframes spin{
0% {transform:rotateZ(0deg);}
100% {transform:rotateZ(360deg);}
}
#-o-keyframes spin{
0% {transform:rotateZ(0deg);}
100% {transform:rotateZ(360deg);}
}
Check it on fiddle
Related
I have a WordPress site: http://powersmart.tech/wordpress/
I want my webiste logo to rotate like this: https://www.dropbox.com/s/b2h29c8zdpfmuvi/video-1477647190.mp4?dl=0
I have made my logo to rotate in a circle using following code:
#Top_bar #logo img {
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
#-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
#-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
#keyframes spin { 100% { -webkit-transform: rotate(360deg);
transform:rotate(360deg); } }
Please guide me.
Thanks
You're using the wrong transformation type, this is achieved using scaleX rather then rotate. I've made a small demo how this should work:
#logo {
margin: 50px;
width: 50px;
height: 50px;
background-color: red;
-webkit-animation: spin 1s linear infinite;
-moz-animation: spin 1s linear infinite;
animation: spin 1s linear infinite;
}
#-moz-keyframes spin {
50% {
-moz-transform: scaleX(0.1);
}
}
#-webkit-keyframes spin {
50% {
-webkit-transform: scaleX(0.1);
}
}
#keyframes spin {
50% {
-webkit-transform: scaleX(0.1));
transform: scaleX(0.1);
}
}
<div id="logo"> hi </div>
I have a header with the background being animated between two images.
header {
margin-top: 80px; /* navbar height */
padding-top: 60px !important;
padding-bottom: 50px !important;
background: rgba(255,215,0,1) !important;
background-size: cover;
/*
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center top;*/
-webkit-animation: animation-home-background 15000ms infinite;
-moz-animation: animation-home-background 15000ms infinite;
-o-animation: animation-home-background 15000ms infinite;
animation: animation-home-background 15000ms infinite;
-webkit-animation-delay: 1s; /* Chrome, Safari, Opera */
animation-delay: 1s;
}
#-webkit-keyframes animation-home-background {
25% {background-image: url("../img/header/h2.jpg"); }
50% {background-image: url("../img/header/h1.jpg"); }
100% {background-image: url("../img/header/h2.jpg"); }
}
#keyframes animation-home-background {
25% {background-image: url("../img/header/h2.jpg"); }
50% {background-image: url("../img/header/h1.jpg"); }
100% {background-image: url("../img/header/h2.jpg"); }
}
Now the first image just appears out of the blue. How can I make sure that the first image fades in smoothly from the yellow background color?
I haven't understand exactly what you want because you have used code paths for images related to your project.
Even so, I developed a prototype in JSFiddle which replaces your images by colors and cut off all "!important".
header {
width: 100%;
height: 100px;
background: blue;
-webkit-animation: animation-home-background 15000ms infinite;
-moz-animation: animation-home-background 15000ms infinite;
-o-animation: animation-home-background 15000ms infinite;
animation: animation-home-background 15000ms infinite;
-webkit-animation-delay: 1s; /* Chrome, Safari, Opera */
animation-delay: 1s;
}
#-webkit-keyframes animation-home-background {
25% {background: red; }
50% {background: blue; }
100% {background: red; }
}
#keyframes animation-home-background {
25% {background: red; }
50% {background: blue; }
100% {background: red; }
}
https://jsfiddle.net/xj9t62a2/
Use "!Important" is a bad practice and can bring you much more complicated problems to solve.
So I'm using code from this link:
http://thecodeplayer.com/walkthrough/pure-css3-animated-clouds-background
Which contains:
#-webkit-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
#-moz-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
#-o-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
And it's causing this error:
"Parser Error
Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.
Parser Error Message: "-" is not valid at the start of a code block.
Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 185: } Line 186: Line 187: #-o-keyframes moveclouds { Line
188: 0% { Line 189: margin-left: 1000px;"
If I remove the "at-rules" it'll work just fine; however, the clouds won't move.
Since Visual Studio's "#" sign indicates the beginning of .net code in a CSHTML file, one needs to double the "#" sign to cancel it out. Like so:
##-webkit-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
However, if you add the CSS code in the CSS file, one "#" sign will work, like so:
#-webkit-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
in witch file you store the css?
all working fine http://jsfiddle.net/jsbot/cr5g6580/
copy to index.html file
<div id="clouds">
<div class="cloud x1"></div>
<!-- Time for multiple clouds to dance around -->
<div class="cloud x2"></div>
<div class="cloud x3"></div>
<div class="cloud x4"></div>
<div class="cloud x5"></div>
</div>
and to style.css
/*Lets start with the cloud formation rather*/
/*The container will also serve as the SKY*/
*{ margin: 0; padding: 0;}
body {
/*To hide the horizontal scroller appearing during the animation*/
overflow: hidden;
}
#clouds{
padding: 100px 0;
background: #c9dbe9;
background: -webkit-linear-gradient(top, #c9dbe9 0%, #fff 100%);
background: -linear-gradient(top, #c9dbe9 0%, #fff 100%);
background: -moz-linear-gradient(top, #c9dbe9 0%, #fff 100%);
}
/*Time to finalise the cloud shape*/
.cloud {
width: 200px; height: 60px;
background: #fff;
border-radius: 200px;
-moz-border-radius: 200px;
-webkit-border-radius: 200px;
position: relative;
}
.cloud:before, .cloud:after {
content: '';
position: absolute;
background: #fff;
width: 100px; height: 80px;
position: absolute; top: -15px; left: 10px;
border-radius: 100px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
-webkit-transform: rotate(30deg);
transform: rotate(30deg);
-moz-transform: rotate(30deg);
}
.cloud:after {
width: 120px; height: 120px;
top: -55px; left: auto; right: 15px;
}
/*Time to animate*/
.x1 {
-webkit-animation: moveclouds 15s linear infinite;
-moz-animation: moveclouds 15s linear infinite;
-o-animation: moveclouds 15s linear infinite;
}
/*variable speed, opacity, and position of clouds for realistic effect*/
.x2 {
left: 200px;
-webkit-transform: scale(0.6);
-moz-transform: scale(0.6);
transform: scale(0.6);
opacity: 0.6; /*opacity proportional to the size*/
/*Speed will also be proportional to the size and opacity*/
/*More the speed. Less the time in 's' = seconds*/
-webkit-animation: moveclouds 25s linear infinite;
-moz-animation: moveclouds 25s linear infinite;
-o-animation: moveclouds 25s linear infinite;
}
.x3 {
left: -250px; top: -200px;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
transform: scale(0.8);
opacity: 0.8; /*opacity proportional to the size*/
-webkit-animation: moveclouds 20s linear infinite;
-moz-animation: moveclouds 20s linear infinite;
-o-animation: moveclouds 20s linear infinite;
}
.x4 {
left: 470px; top: -250px;
-webkit-transform: scale(0.75);
-moz-transform: scale(0.75);
transform: scale(0.75);
opacity: 0.75; /*opacity proportional to the size*/
-webkit-animation: moveclouds 18s linear infinite;
-moz-animation: moveclouds 18s linear infinite;
-o-animation: moveclouds 18s linear infinite;
}
.x5 {
left: -150px; top: -150px;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
transform: scale(0.8);
opacity: 0.8; /*opacity proportional to the size*/
-webkit-animation: moveclouds 20s linear infinite;
-moz-animation: moveclouds 20s linear infinite;
-o-animation: moveclouds 20s linear infinite;
}
#-webkit-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
#-moz-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
#-o-keyframes moveclouds {
0% {margin-left: 1000px;}
100% {margin-left: -1000px;}
}
I want this animation will happen after every 5sec.
Here is my code
css:
div {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: mymove 1s infinite; /* Chrome, Safari, Opera */
animation: mymove 1s infinite;
-webkit-animation-delay: 1s;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove {
from {-webkit-transform:rotatey(0deg);}
to {-webkit-transform:rotatey(180deg);}
}
#keyframes mymove {
from {-webkit-transform:rotatey(0deg);}
to {-webkit-transform:rotatey(180deg);}
}
HTML:
<div></div>
This should do the trick:
div {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: mymove 7s infinite; /* Chrome, Safari, Opera */
animation: mymove 7s infinite;
-webkit-animation-delay: 1s;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove {
0% {-webkit-transform:rotatey(0deg);}
14.29% {-webkit-transform:rotatey(180deg);}
28.57% {-webkit-transform:rotatey(0deg);}
}
#keyframes mymove {
0% {transform:rotatey(0deg);}
14.29% {transform:rotatey(180deg);}
28.57% {transform:rotatey(0deg);}
}
Tested on Chrome and Firefox.
http://jsfiddle.net/58dex5oq/
I am trying to write a simple CSS crossfade animation that transitions between 4 different images, but it does not work in any version of Firefox (I am testing this on v.30), Internet Explorer, or Opera. It works just fine in Chrome and Safari, though.
I have looked all over and seen similar problems, but sadly no solutions that work. What is very odd is that I had a MUCH more complex crossfade animation that worked and transitioned between images using both ease-in and ease-out and that worked just fine on all browsers. (I may post it for reference later)
I have tried this both with and without the markups for individual browsers with the same results. Also, I heard that the generic markups should always go last, but doing so yields the same result.
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="crossfade.css">
</head>
<div id="crossfade">
</div>
</html>
CSS:
#crossfade {
width: 1000px;
height: 200px;
-webkit-backface-visibility: hidden;
-webkit-animation: myfirst 30s infinite; /* Chrome, Safari, Opera */
-moz-animation: myfirst 30s infinite ;
-o-animation: myfirst 30s infinite;
-ms-animation: myfirst 30s infinite;
animation: myfirst 30s infinite;
}
#-webkit-keyframes myfirst {
0% {background-image:url('images/summerbg1.png');}
35% {background-image:url('images/summerbg2.png');}
75% {background-image:url('images/summerbg3.png');}
100% {background-image:url('images/summerbg4.png');}
}
#-moz-keyframes myfirst {
0% {background-image:url('images/summerbg1.png');}
35% {background-image:url('images/summerbg2.png');}
75% {background-image:url('images/summerbg3.png');}
100% {background-image:url('images/summerbg4.png');}
}
#-o-keyframes myfirst {
0% {background-image:url('images/summerbg1.png');}
35% {background-image:url('images/summerbg2.png');}
75% {background-image:url('images/summerbg3.png');}
100% {background-image:url('images/summerbg4.png');}
}
#-ms-keyframes myfirst {
0% {background-image:url('images/summerbg1.png');}
35% {background-image:url('images/summerbg2.png');}
75% {background-image:url('images/summerbg3.png');}
100% {background-image:url('images/summerbg4.png');}
}
#keyframes myfirst {
0% {background-image:url('images/summerbg1.png');}
35% {background-image:url('images/summerbg2.png');}
75% {background-image:url('images/summerbg3.png');}
100% {background-image:url('images/summerbg4.png');}
}
Per Rob's advice, here is what I did using figure tags instead of div. It looks almost exactly the same as the animations, but works in IE, Firefox, Chrome, Opera, and Safari. (I did not, however, test this on versions of IE earlier than 8).
HTML:
<html>
<head>
<title>Site</title>
<link rel="stylesheet" type="text/css" href="crossfade.css">
</head>
<div id="xfade">
<figure>
<img src="Summer/images/summerbg1.png" />
</figure>
<figure>
<img src="Summer/images/summerbg2.png" />
</figure>
<figure>
<img src="Summer/images/summerbg3.png" />
</figure>
<figure>
<img src="Summer/images/summerbg4.png" />
</figure>
</div>
</html>
CSS:
#xfade{
position: relative;
max-width: 1000px;
height: 200px;
margin: 0 auto;
}
#xfade figure{
margin: 0 auto;
max-width: 1000px;
height: 200px;
position: absolute;
}
#xfade img{
width: 1000px;
height: 200px;
}
#xfade figure{
opacity:0;
}
figure:nth-child(1) {
animation: xfade 48s 0s infinite;
-moz-animation: xfade 48s 0s infinite; /* Firefox */
-webkit-animation: xfade 48s 0s infinite; /* Safari and Chrome */
-o-animation: xfade 48s 0s infinite;
}
figure:nth-child(2) {
animation: xfade 48s 12s infinite;
-moz-animation: xfade 48s 12s infinite; /* Firefox */
-webkit-animation: xfade 48s 12s infinite; /* Safari and Chrome */
-o-animation: xfade 48s 12s infinite;
}
figure:nth-child(3) {
animation: xfade 48s 24s infinite;
-moz-animation: xfade 48s 24s infinite; /* Firefox */
-webkit-animation: xfade 48s 24s infinite; /* Safari and Chrome */
-o-animation: xfade 48s 24s infinite;
}
figure:nth-child(4) {
animation: xfade 48s 36s infinite;
-moz-animation: xfade 48s 36s infinite; /* Firefox */
-webkit-animation: xfade 48s 36s infinite; /* Safari and Chrome */
-o-animation: xfade 48s 36s infinite;
}
#-webkit-keyframes xfade{ /* Safari and Chrome */
0%{
opacity: 0;
}
2%{
opacity: 1;
}
25% {
opacity: 1;
}
40%{
opacity: 0;
}
}
#-moz-keyframes xfade {
0%{
opacity: 0;
}
2%{
opacity: 1;
}
25% {
opacity: 1;
}
40%{
opacity: 0;
}
}
#-o-keyframes xfade {
0%{
opacity: 0;
}
2%{
opacity: 1;
}
25% {
opacity: 1;
}
40%{
opacity: 0;
}
}
#-ms-keyframes xfade {
0%{
opacity: 0;
}
2%{
opacity: 1;
}
25% {
opacity: 1;
}
40%{
opacity: 0;
}
}
#keyframes xfade{
0%{
opacity: 0;
}
2%{
opacity: 1;
}
25% {
opacity: 1;
}
40%{
opacity: 0;
}
}