any idea why this doesn't work in any other browsers apart from Firefox?
I have tried chrome, safari and IE (obviously, it won't work, because nothing does with IE).
thanks!
the SASS code is below, in case it helps:
#import url(http://fonts.googleapis.com/css?family=Bree+Serif);
$w: 200;
$h: 180;
$duration: 300ms;
$timing-fn: ease;
$turquoise: #1ABC9C;
$wet-asphalt: #34495E;
$midnight-blue: #2C3E50;
$clouds: #ECF0F1;
* {box-sizing: border-box}
body {background-color: #fff}
h1 {
margin: 0 auto 5px;
text-align: center;
}
h3 {font-family: 'Bree Serif', serif}
.container {
width: 840px;
margin: 0 auto;
}
header {
font-family: 'Bree Serif', serif;
text-align: center;
margin: 50px 0 25px;
color: $wet-asphalt;
p {
margin: 0;
color: transparentize($wet-asphalt, .6);
}
}
ul {
padding: 0;
margin: 0 0 50px;
&:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
}
li {
position: relative;
overflow: hidden;
border-radius: 4px;
list-style: none;
float: left;
width: #{$w}px;
height: #{$h}px;
margin: 5px;
padding: 0;
perspective: 500px;
a {
display: inline-block;
vertical-align: top;
text-decoration: none;
border-radius: 4px;
}
h3 {
margin: 0;
font-size: 16px;
color: transparentize(#fff, .1);
}
p {
font-size: 12px;
line-height: 1.5;
color: transparentize(#fff, .2);
}
.normal {
width: 100%;
height: 100%;
background-color: $clouds;
color: transparentize($wet-asphalt, .4);
box-shadow: inset 0 2px 20px darken($clouds, 2);
text-align: center;
font-size: 50px;
line-height: #{$h}px;
svg {
pointer-events: none;
width: 50px;
path {
fill: transparentize($wet-asphalt, .8);
}
}
}
.info {
width: 100%;
height: 100%;
padding: 20px;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
border-radius: 4px;
pointer-events: none;
background-color: transparentize($turquoise, .1);
transform: rotate3d(1, 0, 0, 90deg);
}
}
.in-top .info {
transform-origin: 50% 0%;
animation: in-top $duration $timing-fn 0ms 1 forwards;
}
.in-right .info {
transform-origin: 100% 0%;
animation: in-right $duration $timing-fn 0ms 1 forwards;
}
.in-bottom .info {
transform-origin: 50% 100%;
animation: in-bottom $duration $timing-fn 0ms 1 forwards;
}
.in-left .info {
transform-origin: 0% 0%;
animation: in-left $duration $timing-fn 0ms 1 forwards;
}
.out-top .info {
transform-origin: 50% 0%;
animation: out-top $duration $timing-fn 0ms 1 forwards;
}
.out-right .info {
transform-origin: 100% 50%;
animation: out-right $duration $timing-fn 0ms 1 forwards;
}
.out-bottom .info {
transform-origin: 50% 100%;
animation: out-bottom $duration $timing-fn 0ms 1 forwards;
}
.out-left .info {
transform-origin: 0% 0%;
animation: out-left $duration $timing-fn 0ms 1 forwards;
}
#keyframes in-top {
from {transform: rotate3d(-1, 0, 0, 90deg);}
to {transform: rotate3d(0, 0, 0, 0deg);}}
#keyframes in-right {
from {transform: rotate3d(0, -1, 0, 90deg);}
to {transform: rotate3d(0, 0, 0, 0deg);}}
#keyframes in-bottom {
from {transform: rotate3d(1, 0, 0, 90deg);}
to {transform: rotate3d(0, 0, 0, 0deg);}}
#keyframes in-left {
from {transform: rotate3d(0, 1, 0, 90deg);}
to {transform: rotate3d(0, 0, 0, 0deg);}}
#keyframes out-top {
from {transform: rotate3d(0, 0, 0, 0deg);}
to {transform: rotate3d(-1, 0, 0, 102deg);}}
#keyframes out-right {
from {transform: rotate3d(0, 0, 0, 0deg);}
to {transform: rotate3d(0, -1, 0, 102deg);}}
#keyframes out-bottom {
from {transform: rotate3d(0, 0, 0, 0deg);}
to {transform: rotate3d(1, 0, 0, 101deg);}}
#keyframes out-left {
from {transform: rotate3d(0, 0, 0, 0deg);}
to {transform: rotate3d(0, 1, 0, 102deg);}}
Related
I have 4 cards that lay flat and "stand up" on hover however they also flip as they had a front and a back. I only want one-sided cards and I don't know how to stop them flipping. I have removed the html for the back of the card however I can't seem to stop the card flipping in CSS. What do I need to change in my code to stop them flipping?
.card-holder {
width: 90%;
height: 70%;
position: absolute;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: -370em;
text-align: center;
}
div:target .card-face {
animation: flip-2 1s;
animation-fill-mode: forwards;
}
div:target .card-face:before {
animation: shadow-2 1s;
animation-fill-mode: forwards;
}
.card {
display: inline-block;
perspective: 1000px;
position: relative;
margin: 50px;
}
.card:hover .card-face {
animation: flip-2 1s;
animation-fill-mode: forwards;
}
.card:before{
animation: shadow-2 1s;
animation-fill-mode: forwards;
}
.card-face {
display: block;
width: 139px;
height: 250px;
transform-origin: bottom;
animation: flip 1s;
animation-direction: reverse;
animation-fill-mode: forwards;
}
.front-card, .project-img {
width: inherit;
height: inherit;
}
.card:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
transition: all 0.5s;
transform-origin: bottom;
animation: shadow 1s;
animation-direction: normal;
animation-fill-mode: forwards;
}
.card-face {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front-card {
/* backface-visibility: hidden; */
position: absolute;
top: 0;
left: 0;
}
/* .back-card {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
z-index: 2;
} */
.front-card {
transform: rotateY(180deg);
}
#keyframes flip {
0% {
transform: rotateX(50deg) rotateY(0deg);
}
60% {
transform: rotateX(0deg);
}
100% {
transform: rotateX(0deg) rotateY(180deg);
}
}
#keyframes shadow {
0% {
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
transform: rotateX(0deg) translateZ(-60px) scale(0.85);
opacity: 1;
}
60% {
transform: rotateX(95deg) translateZ(-40px) scaleY(0.15) scaleX(0.65) rotateY(0);
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
opacity: 0.25;
}
100% {
transform: rotateX(95deg) translateZ(-40px) scaleY(0.05) scaleX(0.65) rotateY(0);
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
opacity: 0.25;
}
}
/* #keyframes flip-2 {
0% {
transform: rotateX(50deg) rotateY(0deg);}
60% {
transform: rotateX(0deg); }
100% {
transform: rotateX(0deg) rotateY(180deg);}
} */
#keyframes shadow-2 {
0% {
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
transform: rotateX(0deg) translateZ(-60px) scale(0.85);
opacity: 1;}
60% {
transform: rotateX(95deg) translateZ(-40px) scaleY(0.15) scaleX(0.65) rotateY(0);
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
opacity: 0.25;}
100% {
transform: rotateX(95deg) translateZ(-40px) scaleY(0.05) scaleX(0.65) rotateY(0);
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
opacity: 0.25;}
}
<div class="card-holder" id="all-cards">
<div class="card" id="card-1">
<a href="#card-1" class="card-face">
<div class="front-card">
<img class="project-img" src="https://i.imgur.com/0RUrrQF.jpg" alt="Death">
</div>
</a>
</div>
<div class="card" id="card-2">
<a href="#card-2" class="card-face">
<div class="front-card">
<img class="project-img" src="https://i.imgur.com/ulOYmlT.jpg" alt="Death">
</div>
</a>
</div>
</div>
remove this line line 100% {
transform: rotateX(0deg) rotateY(180deg);
} from ...
#keyframes flip {
0% {
transform: rotateX(50deg) rotateY(0deg);
}
60% {
transform: rotateX(0deg);
}
100% {
transform: rotateX(0deg) rotateY(180deg);
}
}
Im trying to use this character
֍
in place of a loading spinner.
Here's what I've got so far:
.spinner::after {
animation: rotating 2s linear infinite;
content: "֍";
font-size: 60px;
display: inline-block;
font-weight: normal;
transform-origin: 50% 50%;
}
#keyframes rotating {
0% {
transform: rotate(0deg) scale(1);
color: rgba(0, 0, 0, .5);
}
50% {
transform: rotate(180deg) scale(.8);
color: rgba(0, 0, 0, .85);
}
100% {
transform: rotate(360deg);
color: rgba(0, 0, 0, .5);
}
}
<i class="spinner"></i>
Even though this works, it is not perfect because the rotation does currently not happen around the perfect center of the character despite
transform-origin: 50% 50%;
making it look less than stellar.
Any ideas how to fix this?
I would use a fixed height equal to the font-size then play with line-height until I get it right. Also no need to set transform-origin since by default it's set to center
.spinner::after {
content: "֍";
font-size: 60px;
font-weight: normal;
line-height: 0.8;
display: inline-block;
height: 60px;
animation: rotating 2s linear infinite;
}
#keyframes rotating {
0% {
transform: rotate(0deg) scale(1);
color: rgba(0, 0, 0, .5);
}
50% {
transform: rotate(180deg) scale(.8);
color: rgba(0, 0, 0, .85);
}
100% {
transform: rotate(360deg);
color: rgba(0, 0, 0, .5);
}
}
<i class="spinner"></i>
it happens because a character height and width are not equal...
I tried to increase the height until It does what you want..
and here is the result:
.spinner::after {
animation: rotating 2s linear infinite;
content: "֍";
height: 80px;
font-size: 60px;
display: inline-block;
font-weight: normal;
}
#keyframes rotating {
0% {
transform: rotate(0deg) scale(1);
color: rgba(0, 0, 0, .5);
}
50% {
transform: rotate(180deg) scale(.8);
color: rgba(0, 0, 0, .85);
}
100% {
transform: rotate(360deg);
color: rgba(0, 0, 0, .5);
}
}
<i class="spinner"></i>
Three Properties
line-height: 3;
transform-origin: 50% 54%;
text-align: center;
Demo
.spinner::after {
animation: spin 2s infinite linear;
content: "֍";
font-size: 5em;
display: inline-block;
font-weight: normal;
/* Required */
line-height: 3;
/* Required */
transform-origin: 50% 54%;
/* Required */
text-align: center;
/* Optional for Position */
position: relative;
width: 3em;
top: 0;
}
#keyframes spin {
0% {
transform: rotate(0deg) scale(1);
color: rgba(0, 0, 0, .5);
}
50% {
transform: rotate(180deg) scale(.8);
color: rgba(0, 0, 0, .85);
}
100% {
transform: rotate(360deg);
color: rgba(0, 0, 0, .5);
}
}
<i class="spinner"></i>
You will not get perfect center while rotating rectangle shape but you will get perfect center if its square shape
see demo below
div {
display: inline-block;
width: 100px;
height: 100px;
background-color: brown;
text-align: center;
position: relative;
margin: 10px;
float: left;
}
.spinner0::after {
animation: rotating 2s linear infinite;
content: "֍";
height: 80px;
font-size: 60px;
display: inline-block;
font-weight: normal;
}
#keyframes rotating {
0% {
transform: rotate(0deg) scale(1);
color: rgba(0, 0, 0, .5);
}
50% {
transform: rotate(180deg) scale(.8);
color: rgba(0, 0, 0, .85);
}
100% {
transform: rotate(360deg);
color: rgba(0, 0, 0, .5);
}
}
div > i:before {
content: '';
width: 5px;
height: 5px;
background-color: #000;
border-radius: 50%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.spinner1::after{
animation: rotating 5s linear infinite;
content: "֍";
font-size: 60px;
line-height: 60px;
display: inline-block;
font-weight: normal;
position: absolute;
left: 50%;
top: 50%;
margin-top: -30px;
margin-left: -22px;
}
.spinner2::after {
animation: rotating 5s linear infinite;
content: "֍";
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
font-size: 60px;
transform: rotate(90deg);
margin-left: 2px;
}
.spinner3::after {
animation: rotating 5s linear infinite;
content: "";
height: 30px;
width: 30px;
font-size: 60px;
line-height: 1;
display: inline-block;
font-weight: normal;
border: 1px solid #000;
position: absolute;
left: 50%;
top: 50%;
margin-top: -15px;
margin-left: -15px;
}
<div>
<i class="spinner1"></i>
</div>
<div>
<i class="spinner2"></i>
</div>
<div>
<i class="spinner3"></i>
</div>
if you still want to rotate rectangular shape/icon then along with rotation you have to adjust its position a bit
hope you got my point here
I want to perform some div animation with intervals. In the first time the animation will play, and then it will be delayed, and then (from the second time) there will be an interval. After that, the animation will be played every X seconds.
This is what I got so far, but the animation starts after delay:
#-webkit-keyframes shake {
10%,
90% {
-webkit-transform: translate3d(-1px, 0, 0);
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
-webkit-transform: translate3d(2px, 0, 0);
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
-webkit-transform: translate3d(-4px, 0, 0);
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
-webkit-transform: translate3d(4px, 0, 0);
transform: translate3d(4px, 0, 0);
}
}
#keyframes shake {
10%,
90% {
-webkit-transform: translate3d(-1px, 0, 0);
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
-webkit-transform: translate3d(2px, 0, 0);
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
-webkit-transform: translate3d(-4px, 0, 0);
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
-webkit-transform: translate3d(4px, 0, 0);
transform: translate3d(4px, 0, 0);
}
}
.error-container {
position: absolute;
left: auto;
border-collapse: separate;
margin: 0;
padding: 2px 10px;
list-style: none;
color: #ffffff;
font-size: 12px;
font-weight: 600;
background: #d9534f;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
display: none;
z-index: 100;
&.active {
display: block;
-webkit-animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both 4s infinite;
animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both 4s infinite;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px;
perspective: 1000px;
}
}
Is it possible without any JavaScript?Thanks.
Update: here is a demo: [demo][1]
Here you go. What I did is I changed the code so that complete animation ends at 20% and after that it will do nothing till 100%. For more details, visit this link
NOTE: You can clone the webkit to keyframes code as well. I removed it
#-webkit-keyframes shake {
2%,
18% {
-webkit-transform: translate3d(-1px, 0, 0);
transform: translate3d(-1px, 0, 0);
}
4%,
16% {
-webkit-transform: translate3d(2px, 0, 0);
transform: translate3d(2px, 0, 0);
}
6%,
10%,
14% {
-webkit-transform: translate3d(-4px, 0, 0);
transform: translate3d(-4px, 0, 0);
}
8%,
12% {
-webkit-transform: translate3d(4px, 0, 0);
transform: translate3d(4px, 0, 0);
}
100%{
-webkit-transform: translate3d(0px, 0, 0);
transform: translate3d(0px, 0, 0);
}
}
.error-container {
position: absolute;
left: auto;
border-collapse: separate;
margin: 0;
padding: 2px 10px;
list-style: none;
color: #ffffff;
font-size: 12px;
font-weight: 600;
background: #d9534f;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
display: none;
z-index: 100;
&.active {
display: block;
animation: shake 4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both infinite;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px;
perspective: 1000px;
}
}
You can change iteration on animation-duration
here is example
#import url(https://fonts.googleapis.com/css?family=Montserrat:700,400);
* {
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: purple;
font-family: 'Montserrat', sans-serif;
}
html, body {
height: 100%;
}
button {
background: #333;
color: #fff;
border-radius: 40px;
padding: 15px 30px;
border: 0;
overflow: hidden;
width: 200px;
transition:
all 1.2s,
border 0.5s 1.2s,
box-shadow 0.3s 1.5s;
white-space: nowrap;
text-indent: 23px;
font-weight: bold;
}
span {
display: inline-block;
transform: translateX(300px);
font-weight: normal;
opacity: 0;
transition:
opacity 0.1s 0.5s,
transform 0.4s 0.5s;
}
button:hover {
text-indent: 0;
background: #55706D;
color: #FFE8A3;
width: 250px;
}
button:hover span {
transform: translateX(0);
opacity: 1;
}
<button>
Animate
<span>After Delay</span>
</button>
I am trying to create a pulse effect around this button.
Unfortunately its not working... and I can't find the error.
#pulse {
width: 50px;
height: 100%;
}
#show {
float: left;
margin-top: -200px;
margin-left: 10px;
border: none;
height: 40px;
width: 40px;
box-shadow: 0 0 0 0 rgba(232, 76, 61, 0.7);
border-radius: 50%;
background: none;
cursor: pointer;
background-image: url('bilder/showleftside.svg');
background-repeat: no-repeat;
background-size: cover;
-webkit-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-moz-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-ms-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
}
#keyframes pulse {
0% {
transform: scale(1, 1);
}
50% {
opacity: 0.3;
}
100% {
transform: scale(1.5);
opacity: 0;
}
}
<div id="pulse">
<button id="show" type="button" onclick=""></button>
</div>
You defined a animation with name pulse. What this pulse animation is supposed to do is missing in your code. Add keyframes to define your animation.
https://developer.mozilla.org/en-US/docs/Web/CSS/#keyframes
#pulse {
width: 50px;
height: 100%;
}
#show {
float: left;
margin: 20px;
border: 1px solid #ddd;
height: 40px;
width: 40px;
box-shadow: 0 0 0 0 rgba(232, 76, 61, 0.7);
border-radius: 50%;
background: none;
cursor: pointer;
background-image: url('bilder/showleftside.svg');
background-repeat: no-repeat;
background-size: cover;
-webkit-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-moz-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
-ms-animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
animation: pulse 1.25s infinite cubic-bezier(0.66, 0, 0, 1);
}
#keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
<div id="pulse">
<button id="show" type="button">X</button>
</div>
I have a code font-icon animation my problem is when i run in local server animation does'nt works it works only in http://codepen.io/TimPietrusky/pen/ELuiG
and even tried in
http://jsfiddle.net/qjo7cf3j/
#import url(http://weloveiconfonts.com/api/?family=maki);
html,
body {
height: 100%;
width: 100%;
overflow: hidden;
background: #333;
}
[class*="maki-"]:before{
font-family: 'maki', sans-serif;
}
*:after {
position: absolute;
top: 0;
right: 0;
content: '';
z-index: -1;
width: 0;
height: 0;
}
[class*="maki-"] {
position: absolute;
margin: 0;
color: #fff;
font-size: 2em;
}
.wrapper {
height: 140%;
width: 120%;
transform: rotate(-3deg) translate(-10%, -15%);
}
.night {
position: absolute;
z-index: 5;
width: 100%;
height: 100%;
animation: night 45s infinite forwards;
}
#keyframes night {
0%, 30%, 100% {background:rgba(0, 0, 0, 0);}
55% {background: rgba(0, 0, 0, .6);}
}
.sky {
position: relative;
z-index: 0;
background: url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/bedge_grunge.png);
height: 50%;
width: 100%;
animation: rollin-bg 25s linear infinite forwards;
}
.ground {
position: absolute;
z-index: 1;
background: url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/blackorchid.png);
height: 50%;
width: 100%;
animation: rollin-bg 7s linear infinite forwards;
}
#keyframes rollin-bg {
0% {background-position: 100%;}
100% {background-position: 0;}
}
.sun {
position: absolute;
z-index: 1;
left: 50%;
top: 10%;
width: 2em;
height: 2em;
font-size: 4em;
line-height: 1;
animation: circle 45s linear infinite;
transform-origin: 50% 3.85em;
}
.sun [class*="maki-"] {
color: rgba(240, 180, 0, .2);
text-shadow: 0 0 .35em rgba(240, 240, 0, .7);
}
.sun > div {
animation: inner-circle 45s linear infinite;
}
#keyframes circle {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
#keyframes inner-circle {
from { transform: rotate(0deg); }
to { transform: rotate(-360deg); }
}
.maki-bicycle {
left: 50%;
z-index: 4;
margin: -.85em 0 0 -.5em;
color: rgba(30, 30, 140, .95);
}
.maki-tree-1[data-child="1"] {
margin: -1em 0 0 5%;
z-index: 6;
animation: rollin 5s linear infinite;
font-size: 2.4em;
color: rgba(0, 110, 0, 1);
}
.maki-tree-1[data-child="2"] {
margin: -1em 0 0 85%;
z-index: 2;
animation: rollin 12s linear infinite;
font-size: 1.6em;
color: rgba(0, 110, 0, .5);
}
.maki-tree-1[data-child="3"] {
margin: -1em 0 0 25%;
z-index: 2;
animation: rollin 17s linear infinite;
font-size: 1.2em;
color: rgba(0, 110, 0, .3);
}
.maki-giraffe {
margin: .25em 0 0 5%;
z-index: 6;
animation: rollin 12s linear infinite reverse;
font-size: 10em;
color: rgba(255, 255, 10, .9);
}
.maki-giraffe:after {
right: -3em;
content: '\e82a \e82a \e82a \e82a \e82a';
font: .2em 'Maki', sans-serif;
letter-spacing: .2em;
width: 3em;
color: rgba(0, 0, 0, .6);
box-shadow:
0 .45em 0 .75em rgba(255, 255, 255, .4),
1em .35em 0 .75em rgba(255, 255, 255, .4),
2.25em .25em 0 1.05em rgba(255, 255, 255, .4)
;
border-radius: 50%;
transform: translate(2.3em, .55em) rotateY(-180deg);
}
.maki-grocery-store {
margin: -.35em 0 0 5%;
z-index: 5;
animation: rollin 22s linear infinite;
font-size: 4em;
color: rgba(220, 0, 10, .7);
}
.maki-commerical-building[data-child="1"] {
margin: -1em 0 0 5%;
z-index: 3;
animation: rollin 6s linear infinite;
font-size: 7em;
color: rgba(120, 0, 120, .8);
}
.maki-commerical-building[data-child="2"] {
margin: -1em 0 0 5%;
z-index: 2;
animation: rollin 14s linear infinite;
font-size: 4em;
color: rgba(0, 120, 120, .4);
}
.maki-heliport {
margin: -3.5em 0 0 2em;
z-index: 1;
color: rgba(30, 30, 30, .45);
font-size: 1.25em;
animation: rollin 26s linear infinite reverse 2s;
}
#keyframes rollin {
0% {margin-left:105%}
100% {margin-left:-15%;}
}
<div class="night"></div>
<div class="wrapper">
<div class="sun">
<div class="maki-fast-food"></div>
</div>
<div class="sky"></div>
<span class="maki-bicycle"></span>
<span class="maki-tree-1" data-child="1"></span>
<span class="maki-tree-1" data-child="2"></span>
<span class="maki-tree-1" data-child="3"></span>
<span class="maki-giraffe"></span>
<span class="maki-grocery-store"></span>
<span class="maki-commerical-building" data-child="1"></span>
<span class="maki-commerical-building" data-child="2"></span>
<span class="maki-heliport"></span>
<div class="ground"></div>
</div>
The reason why the animation doesn't work at all in your version, is because the animation properties need prefixes like -webkit- in some browsers.
In the CodePen, -prefix-free is used, which is why it works. It is a library that automatically adds the prefixed version of the CSS properties.
CodePen can also use Autoprefixer (another such library) or neither. Once you select 'neither', you'll see that the CodePen example also doesn't work anymore, because the (S)CSS doesn't contain the required prefixed version for the CSS attributes.
So, the solution: either use a library too, or add the required prefixed attributes for Chrome (and maybe other browsers too).
A similar issue (for a different set of properties) was asked for and answered here.