Help me, how to switch the initial toggle button condition from day to night?
/*
F5EB42 - sun inner
E4C74D - sun outer
FFFFFF - cloud inner
D4D4D2 - cloud outer
81C0D5 - parent outer
C0E6F6 - parent inner
FFFDF2 - moon inner
DEE1C5 - moon outer
FCFCFC - stars
*/
body {
background-color: #F3F3F3;
}
.wrapper {
padding-top: 40px;
text-align: center;
}
.toggle {
position: relative;
display: inline-block;
width: 100px;
margin-left: 100px;
padding: 4px;
border-radius: 40px;
}
.toggle:before,
.toggle:after {
content: '';
display: table;
}
.toggle:after {
clear: both;
}
.toggle-bg {
position: absolute;
top: -4px;
left: -4px;
width: 100%;
height: 100%;
background-color: #C0E6F6;
border-radius: 40px;
border: 4px solid #81C0D5;
transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.toggle-input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 1px solid red;
border-radius: 40px;
z-index: 2;
opacity: 0;
}
.toggle-switch {
position: relative;
width: 40px;
height: 40px;
margin-left: 50px;
background-color: #F5EB42;
border: 4px solid #E4C74D;
border-radius: 50%;
transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.toggle-switch-figure {
position: absolute;
bottom: -14px;
left: -50px;
display: block;
width: 80px;
height: 30px;
border: 8px solid #D4D4D2;
border-radius: 20px;
background-color: #fff;
-webkit-transform: scale(0.4);
transform: scale(0.4);
transition: all 0.12s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.toggle-switch-figure:after {
content: '';
display: block;
position: relative;
top: -65px;
right: -42px;
width: 15px;
height: 15px;
border: 8px solid #D4D4D2;
border-radius: 100%;
border-right-color: transparent;
border-bottom-color: transparent;
-webkit-transform: rotateZ(70deg);
transform: rotateZ(70deg);
background-color: #fff;
}
.toggle-switch-figure:before {
content: '';
display: block;
position: relative;
top: -25px;
right: -10px;
width: 30px;
height: 30px;
border: 8px solid #D4D4D2;
border-radius: 100%;
border-right-color: transparent;
border-bottom-color: transparent;
-webkit-transform: rotateZ(30deg);
transform: rotateZ(30deg);
background-color: #fff;
}
.toggle-switch-figureAlt {
content: '';
position: absolute;
top: 5px;
left: 2px;
width: 2px;
height: 2px;
background-color: #EFEEDA;
border-radius: 100%;
border: 4px solid #DEE1C5;
box-shadow: 42px -7px 0 -3px #FCFCFC, 75px -10px 0 -3px #FCFCFC, 54px 4px 0 -4px #FCFCFC, 83px 7px 0 -2px #FCFCFC, 63px 18px 0 -4px #FCFCFC, 44px 28px 0 -2px #FCFCFC, 78px 23px 0 -3px #FCFCFC;
transition: all 0.12s cubic-bezier(0.25, 0.46, 0.45, 0.94);
-webkit-transform: scale(0);
transform: scale(0);
}
.toggle-switch-figureAlt:before {
content: '';
position: absolute;
top: -6px;
left: 18px;
width: 7px;
height: 7px;
background-color: #EFEEDA;
border-radius: 100%;
border: 4px solid #DEE1C5;
}
.toggle-switch-figureAlt:after {
content: '';
position: absolute;
top: 19px;
left: 15px;
width: 2px;
height: 2px;
background-color: #EFEEDA;
border-radius: 100%;
border: 4px solid #DEE1C5;
}
.toggle-input:checked ~ .toggle-switch {
margin-left: 0;
border-color: #DEE1C5;
background-color: #FFFDF2;
}
.toggle-input:checked ~ .toggle-bg {
background-color: #484848;
border-color: #202020;
}
.toggle-input:checked ~ .toggle-switch .toggle-switch-figure {
margin-left: 40px;
opacity: 0;
-webkit-transform: scale(0.1);
transform: scale(0.1);
}
.toggle-input:checked ~ .toggle-switch .toggle-switch-figureAlt {
-webkit-transform: scale(1);
transform: scale(1);
}
<div class="wrapper">
<div class="toggle">
<input class="toggle-input" type="checkbox" />
<div class="toggle-bg"></div>
<div class="toggle-switch">
<div class="toggle-switch-figure"></div>
<div class="toggle-switch-figureAlt"></div>
</div>
</div>
</div>
should I change "before" and "after" in some cases? or...
Just add the checked attribute to input
<input checked class="toggle-input" type="checkbox" />
change the input tag and set the checked attribute to false. It will work then. Always better to use the checked attribute of the input when you are defining the initial behavior of the component
<input class="toggle-input" type="checkbox" checked="false"/>
Related
I'm trying to create a transition for both an div button and a pseudo element, but for some reason, these transitions appear to be out of sync with each other, resulting in the pseudo element reaching a background color before the div does. I've tried various combinations of style rules, but I never managed to accomplish an ease-in-out transition to work correctly.
.tracking__history {
display: flex;
justify-content: flex-start;
align-items: center;
}
.skew-btn-left {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 120px;
font-size: 20px;
color: #2E8DEF;
background: #0000;
border-top: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
}
.skew-btn-left::after {
content: " ";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -5px;
background: #0000;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
transform-origin: top left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
transition: background 1s;
}
.skew-btn-right {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 120px;
margin-left: 40px;
font-size: 20px;
color: #13bcfa;
background: #0000;
border-top: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
transition: all .5s;
}
.skew-btn-right::after {
content: " ";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -5px;
background: #0000;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
transform-origin: bottom left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
}
div.skew-btn-right:hover,
div.skew-btn-left:hover,
div.skew-btn-right:hover.skew-btn-right::after,
div.skew-btn-left:hover.skew-btn-left::after {
background: #13bcfa;
}
.skew-btn-left a, .skew-btn-right a {
display: flex;
justify-content: center;
align-items: center;
padding: 5px 0px;
text-decoration: none;
color: #13bcfa;
text-transform: uppercase;
}
.skew-btn-left:hover a, .skew-btn-right:hover a {
color: #fff;
}
<div class="tracking__history">
<div class="skew-btn-left">
Tracking
</div>
<div class="skew-btn-right">
History
</div>
</div>
You're transitioning at different speeds, you're also transitioning all attributes which in this case involves things you aren't trying to transition on the pseudo-elements so they're lagging. Sync up your transitions and specify that you're targeting the color and background attributes and you should be good. I simplified your code a bit and if you don't want to transition the text color you can just remove it from the transition.
.tracking__history {
display: flex;
justify-content: flex-start;
align-items: center;
}
.skew-btn-left {
display: flex;
justify-content: center;
align-items: center;
padding: 5px 0px;
text-decoration: none;
color: #13bcfa;
text-transform: uppercase;
position: relative;
width: 120px;
font-size: 20px;
background: white;
border-top: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
transition: background 0.5s linear, color 0.5s linear;
}
.skew-btn-left::after {
content: "";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -2px;
background: white;
color: white;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
transform-origin: top left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
transition: background 0.5s linear, color 0.5s linear;
}
.skew-btn-right {
display: flex;
justify-content: center;
align-items: center;
padding: 5px 0px;
text-decoration: none;
color: #13bcfa;
text-transform: uppercase;
position: relative;
width: 120px;
margin-left: 40px;
font-size: 20px;
background: white;
border-top: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
transition: background 0.5s linear, color 0.5s linear;
}
.skew-btn-right::after {
content: "";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -5px;
background: white;
color: white;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
transform-origin: bottom left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
transition: background 0.5s linear, color 0.5s linear;
}
.skew-btn-right:hover,
.skew-btn-left:hover,
.skew-btn-right:hover.skew-btn-right::after,
.skew-btn-left:hover.skew-btn-left::after {
background: #13bcfa;
color: white;
transition: background 0.5s linear, color 0.5s linear;
}
<div class="tracking__history">
<a class="skew-btn-left" href="">Tracking</a>
<a class="skew-btn-right" href="">History</a>
</div>
Here is another idea with less of code:
.tracking__history {
display: flex;
}
.tracking__history a {
padding: 10px;
position: relative;
z-index: 0;
font-size: 20px;
color: #13bcfa;
text-transform: uppercase;
text-decoration: none;
overflow: hidden;
transition: .2s;
}
.tracking__history a:hover {
color: #fff;
}
.tracking__history a:before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
border: 5px solid #13bcfa;
transform: skewX(25deg); /* control the curvature here */
transition: inherit;
}
.tracking__history a:hover:before {
background: #13bcfa;
}
.tracking__history a:first-child {
padding-right: 30px;
margin-right: -5px;
border-left: 5px solid #13bcfa;
}
.tracking__history a:last-child {
padding-left: 30px;
margin-left: -5px;
border-right: 5px solid #13bcfa;
}
.tracking__history a:first-child:before {
border-left: none;
transform-origin: bottom;
}
.tracking__history a:last-child:before {
border-right: none;
transform-origin: top;
}
<div class="tracking__history">
Tracking
History
</div>
I tried with your buttons, but couldn't. Maybe you'll find these button as a good alternative (needs customizing). From How do I create a trapezoidal button using CSS? and CSS Trapezoid Button With Solid Border
.trapezoid {
width: 230px;
text-align: center;
height: 0;
position: relative;
border-right: 50px solid transparent;
border-top: 40px solid #2963BD;
border-left: 50px solid transparent;
box-sizing: content-box;
transition: all 1s;
}
.trapezoid span {
position: absolute;
top: -30px;
left: 25%;
color: #fff;
}
.trapezoid:hover {
border-top-color: red;
}
.btn {
width: 100px;
height: 50px;
background: red;
float: left;
transition: all 1s;
color: white;
}
.rit {
float: left;
width: 0;
height: 0;
border-top: 50px solid red;
border-right: 100px solid transparent;
transition: all 1s;
}
.wrapper:hover .btn {
background: blue;
}
.wrapper:hover .rit {
border-top-color: blue;
}
button 1:
<div class="trapezoid"><span>Trapezoid Button</span></div>
<hr> button 2:
<span class="wrapper">
<div class="btn">Content</div>
<div class="rit"></div>
</span>
I want it to be like this shape .
Just tell me how to make the not completed borders.
And one last thing is that I have to use one div.<div>Elzero</div> with pseudo-elements
Thanks in advance.
you can make it with transparent border
div
{
background-color: #ddd;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 30px;
margin: 40px auto;
color: black;
width: 200px;
height: 200px;
border-radius: 50%;
position: relative;
}
div::before
{
content: "";
width: 200px;
height: 200px;
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
transform: translate(-10px, -10px);
z-index: -1;
border: 10px solid;
border-color: red red red transparent;
}
body ::after
{
content: "";
width: 220px;
height: 220px;
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
transform: translate(-21px, -22px);
z-index: -8;
border: 12px solid;
background: transparent;
border-color: blue transparent blue blue;
}
<div></div>
Try That Bro :)
div {
background-color: #eee;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 30px;
margin: 50px auto;
height: 200px;
width: 200px;
border-radius: 50%;
position: relative;
}
div::before{
content: "";
height: 200px;
width: 200px;
border-radius: 50%;
border: 10px solid #03a9f4;
border-left-color: transparent;
position: absolute;
top: 0;
left: 0;
transform: translate(-10px, -10px);
z-index: -1;
transition: transform 0.5s linear;
}
div:hover::before{
transform: translate(-10px, -10px) rotate(360deg);
}
div::after {
content: "";
height: 220px;
width: 220px;
border-radius: 50%;
border: 10px solid #e91e63;
border-right-color: transparent;
position: absolute;
top: 0;
left: 0;
transform: translate(-20px, -20px);
z-index: -2;
transition: transform 0.5s 0.5s linear;
}
div:hover::after{
transform: translate(-20px, -20px) rotate(360deg);
}
Just put the text/string 'HERE' in a anchor tag like this:
HERE
I want to build animation like this, but using only css:
I built a triangle, but I can't build a background of moving triangles which will move. See the example in the pictures.
My code:
HTML:
<div class="container">
<div class="triangle up">
</div>
<div class="triangle down-right">
</div>
<div class=" down-right1">
</div>
<div class="triangle down-left">
</div>
</div>
CSS:
.container {
position: relative;
left: 45%;
width: 300px;
height: 250px;
}
.triangle {
position: absolute;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid rgb(165,60,255);
background: linear-gradient(90deg, rgba(165,60,255,1) 0%, rgba(98,0,255,1) 100%);
z-index: 999999;
}
.up {
top: 0;
left: auto;
}
.down-right {
top: 100px;
left: 16.5%;
}
.down-right1 {
top: 105px;
left: 24%;
position: absolute;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid #c85e5e;
}
.down-left {
top: 100px;
left: -16.5%;
}
I want this animation to start when the page is loading.
An idea using skew tranformation and box-shadow.
.box {
position: fixed;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 75px;
height: 64.5px;
transition: 0.5s all 0.5s;
transform-origin: 50% 63%;
}
.box::before,
.box::after,
.box i:before,
.box i:after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 8px;
transform-origin: bottom;
transition: 0.5s all;
}
.box::before {
background: #5840bc;
box-shadow: 0px -20px #886df8, 0px -40px #c2b3f8;
transform: skewX(-30deg);
border-bottom-right-radius: 0;
}
.box::after {
background: #5844d9;
box-shadow: -20px 0 #7d69ca, -40px 0 #c7bee9;
transform: skewX(30deg);
border-top-right-radius: 0;
}
.box i:before {
background: #714ffe;
box-shadow: 0px -20px #7c6ade, 0px -40px #c7bee9;
transform: translateY(50%) rotate(120deg) skewX(-30deg);
transform-origin: center;
border-bottom-right-radius: 0;
}
.box i:after {
background: #fff;
z-index: 1;
clip-path: polygon(50% 0, 100% 100%, 0 100%);
border-radius: 0;
}
html:hover .box {
transform: rotate(60deg);
}
html:hover .box::before,
html:hover .box::after,
html:hover .box i:before,
html:hover .box i:after {
box-shadow: 0px 0 transparent, 0px 0 transparent;
}
<div class="box"><i></i></div>
I have a checkbox with ripple effects. The below code displays the label text first and then the checkbox
I wanted to display the checkbox first and then the label text. The entire div expands and shrinks sometimes,
<style>
#keyframes ripple {
0% {
transform: scale(0,0);
opacity: 1
}
20% {
transform: scale(25,25);
opacity: 1
}
to {
opacity: 0;
transform: scale(40,40)
}
}
#onoff+label {
position: relative;
display: inline-block;
padding-right: 10px
}
#onoff {
position: absolute;
left: -9999px
}
#onoff+label::after {
content: '';
border: 2px solid rgba(0,0,0,.5);
border-radius: 2px;
position: absolute;
top: 50%;
right: -40px;
transform: translate(-20px,-50%);
box-sizing: border-box;
width: 20px;
height: 20px;
transition: background-color 1s;
background-position: -2px -1px;
background-color: rgba(255,0,0,.4)
}
#onoff:checked+label::after {
border: 2px solid #0f9d58;
background-color: rgba(15,157,88,.7);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAQMAAAC3R49OAAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBwEQARzBMMQpAAAAN0lEQVQI12NgQAEHGBgYHzAwMAMxO5DN38AgIM/AYGHHwFBTw8Bg94OBQf4DUBgqzdwAVI5qAACbXgn3nmfmHgAAAABJRU5ErkJggg==)
}
#onoff:disabled+label::after {
border: 2px solid rgba(0,0,0,.1);
background-color: rgba(0,0,0,.05);
background-image: none
}
#onoff+label::before {
content: '';
border-radius: 50%;
background-color: rgba(0,0,0,.1);
position: absolute;
box-sizing: border-box;
top: 50%;
right: -10px;
transform: translate(-50%,-50%) scale(0);
width: 1.8px;
height: 1.8px
}
#onoff:focus+label::before {
animation: ripple 1s ease-out
}
</style>
<div align="left" class="onoffdiv">
<input id="onoff" type="checkbox" style="display:table-column"/>
<label for="onoff" style="margin-right: 30px;" class="lbl gray">Turn on/off</label>
<br/>
</div>
you can do so by using following code
#onoff+label {
margin-left: 30px;
position: relative;
}
#onoff+label::after {
left: -10px;
right: auto;
}
#onoff+label::before {
left: 0;
right: auto;
}
<style>
#keyframes ripple {
0% {
transform: scale(0,0);
opacity: 1
}
20% {
transform: scale(25,25);
opacity: 1
}
to {
opacity: 0;
transform: scale(40,40)
}
}
#onoff+label {
position: relative;
display: inline-block;
padding-right: 10px
}
#onoff {
position: absolute;
left: -9999px
}
#onoff+label::after {
content: '';
border: 2px solid rgba(0,0,0,.5);
border-radius: 2px;
position: absolute;
top: 50%;
right: -40px;
transform: translate(-20px,-50%);
box-sizing: border-box;
width: 20px;
height: 20px;
transition: background-color 1s;
background-position: -2px -1px;
background-color: rgba(255,0,0,.4)
}
#onoff:checked+label::after {
border: 2px solid #0f9d58;
background-color: rgba(15,157,88,.7);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAQMAAAC3R49OAAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBwEQARzBMMQpAAAAN0lEQVQI12NgQAEHGBgYHzAwMAMxO5DN38AgIM/AYGHHwFBTw8Bg94OBQf4DUBgqzdwAVI5qAACbXgn3nmfmHgAAAABJRU5ErkJggg==)
}
#onoff:disabled+label::after {
border: 2px solid rgba(0,0,0,.1);
background-color: rgba(0,0,0,.05);
background-image: none
}
#onoff+label::before {
content: '';
border-radius: 50%;
background-color: rgba(0,0,0,.1);
position: absolute;
box-sizing: border-box;
top: 50%;
right: -10px;
transform: translate(-50%,-50%) scale(0);
width: 1.8px;
height: 1.8px
}
#onoff:focus+label::before {
animation: ripple 1s ease-out
}
#onoff+label {
margin-left: 30px;
position: relative;
}
#onoff+label::after {
left: -10px;
right: auto;
}
#onoff+label::before {
left: 0;
right: auto;
}
</style>
<div align="left" class="onoffdiv">
<input id="onoff" type="checkbox" style="display:table-column"/>
<label for="onoff" class="lbl gray">Turn on/off</label>
<br/>
</div>
HTML
<div class="container-screenz service-graphic sg2">
<div class="screenz monitor">
<img src="img/geoqueri-monitor.jpg">
</div>
<div class="laptop">
<div class="screenz">
<img src="img/geoqueri-laptop.jpg">
</div>
<div class="btm"></div>
</div>
<div class="phone">
<div class="screenz">
<img src="img/geoqueri-phone.jpg">
</div>
<div class="shadow"></div>
</div>
<div class="ipad">
<div class="screenz">
<img src="img/geoqueri-tablet.jpg">
</div>
</div>
</div>
CSS (with added prefixes)
#keyframes scroll {
20%,
60% {
-webkit-transform:translateY(-62%);
-moz-transform:translateY(-62%);
-ms-transform:translateY(-62%);
-o-transform:translateY(-62%);
transform:translateY(-62%);
}
80% {
margin-top: -50px;
}
}
.service-graphic {
max-width: 42.500em;
font-size: 8px;
padding: 1em;
position: relative;
display: block;
margin: 0 auto;
.monitor {
width: 28.750em;
height: 17.5em;
position: relative;
background: #f8f8f8;
border: 0.625em solid #1f1f1f;
#include border-radius(0.625em);
border: 1.25em solid #1f1f1f;
margin: 0 auto;
.content-screenz {
width: 26.25em;
height: 15em;
left: 50%;
margin-left: -13.125em;
overflow: hidden;
}
&:before, &:after {
content: "";
position: absolute;
left: 50%;
}
&:before {
top: -0.25em;
margin: -0.188em 0 0 -0.188em;
width: 0.250em;
height: 0.250em;
#include border-radius(0.250em);
background: #d8dbe1;
top: -0.625em;
}
}
.laptop {
&:before {
content: "";
position: absolute;
left: 50%;
top: -0.25em;
margin: -0.188em 0 0 -0.188em;
width: 0.250em;
height: 0.250em;
#include border-radius(0.250em);
background: #d8dbe1;
top: -0.625em;
}
}
}
.screenz {
&:after {
width: 0.500em;
height: 0.500em;
#include border-radius(0.500em);
margin: 0 0 -0.25em -0.25em;
background: #e8ebf0;
bottom: -0.625em;
}
}
.monitor > div {
position: absolute;
}
.monitor .content-screenz:before,
.laptop .screenz:before,
.phone .screenz:before,
.ipad .screenz:before {
content: "";
position: absolute;
right: -5.625em;
width: 12.500em;
height: 18.750em;
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);
/*linear-gradient*/
background:-webkit-gradient(linear,left top,left bottom,color-stop(rgba(255, 255, 255, 0.5),0),color-stop(rgba(255, 255, 255, 0),1));
/*##prefixmycss->No equivalent*/
background:-webkit-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: -moz-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: -o-linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
z-index: 5;
}
.browser {
width: 15em;
height: 11.250em;
position: absolute;
left: 50%;
top: 50%;
margin: -5.625em 0 0 -7.5em;
background: #ffffff;
border: 1px solid #e8ebf0;
border-top: 1.25em solid #d8dbe1;
#include border-radius(0.313em);
}
.browser-content {
overflow: hidden;
height: 9.938em;
padding-top: 0.625em;
}
.btns {
position: absolute;
top: -1.25em;
left: 0.438em;
&:before {
content: "";
position: absolute;
left: 2.188em;
top: 0.313em;
height: 0.625em;
width: 11.563em;
background: #fff;
#include border-radius(3px);
}
}
.btns > li {
display: inline-block;
list-style: none;
width: 0.313em;
height: 0.313em;
#include border-radius(0.313em);
background: #fc5254;
margin-right: 0.250em;
}
.btns li:nth-child(2) {
background: #fcae52;
}
.btns li:nth-child(3) {
background: #66b34e;
}
.base {
width: 5.625em;
height: 3.1em;
bottom: -3.9em;
left: 50%;
margin-left: -2.8125em;
background: #e8ebf0;
bottom: -4.3em;
z-index: -1;
}
.base:before,
.base:after,
.grey-shadow:before,
.grey-shadow:after {
content: "";
position: absolute;
top: 0;
}
.base:before {
border-left: 0.813em solid transparent;
border-right: 0px solid transparent;
border-bottom: 3.125em solid #e8ebf0;
left: -0.77em;
}
.base:after {
border-right: 0.813em solid transparent;
border-left: 0px solid transparent;
border-bottom: 3.125em solid #e8ebf0;
right: -0.77em;
}
.base > div {
position: absolute;
}
.grey-shadow {
width: 5.625em;
height: 0.750em;
background: #d8dbe1;
top: 0;
}
.grey-shadow:before {
border-left: 3px solid transparent;
border-right: 0px solid transparent;
border-bottom: 0.75em solid #d8dbe1;
left: -3px;
}
.grey-shadow:after {
border-right: 3px solid transparent;
border-left: 0px solid transparent;
border-bottom: 0.75em solid #d8dbe1;
right: -2px;
z-index: 1;
}
.foot {
background: #e8ebf0;
}
.foot.top {
width: 7.250em;
height: 0.313em;
bottom: -0.3em;
left: 50%;
margin-left: -3.625em;
}
.foot.top:before,
.foot.top:after,
.foot.bottom:before {
content: "";
position: absolute;
top: 0px;
}
.foot.top:before {
border-left: 16px solid transparent;
border-right: 0px solid transparent;
border-bottom: 5px solid #e8ebf0;
left: -16px;
}
.foot.top:after {
border-right: 1em solid transparent;
border-left: 0px solid transparent;
border-bottom: 5px solid #e8ebf0;
right: -1em;
}
.foot.bottom {
width: 9.375em;
height: 0.313em;
bottom: -0.625em;
left: 50%;
margin-left: -4.688em;
}
.laptop {
width: 14.688em;
height: 9.688em;
background: #f8f8f8;
border: 0.75em solid #1f1f1f;
-webkit-border-radius:10px 10px 0 0;
-moz-border-radius:10px 10px 0 0;
border-radius:10px 10px 0 0;
position: absolute;
top: 14.5em;
right: 1.875em;
z-index: 10;
}
.laptop:before {
top: -0.3em;
}
.laptop > div {
position: absolute;
}
.laptop > .screenz {
width: 13.188em;
height: 8.188em;
left: 0;
margin-left: 0;
background: #fff;
overflow: hidden;
}
.btm {
width: 18.500em;
height: 0.625em;
bottom: -1.188em;
left: 50%;
margin-left: -9.25em;
-webkit-border-radius:0 0 20px 20px;
-moz-border-radius:0 0 20px 20px;
border-radius:0 0 20px 20px;
background: #e8ebf0;
z-index: 1;
}
.btm:before {
content: "";
position: absolute;
width: 42px;
height: 4px;
left: 50%;
top: 0;
margin-left: -21px;
-webkit-border-radius:0 0 5px 5px;
-moz-border-radius:0 0 5px 5px;
border-radius:0 0 5px 5px;
background: #d8dbe1;
}
.btm:after {
display: none;
content: "";
position: absolute;
width: 100%;
height: 0.25rem;
background: #bababa;
top: .5rem;
border-bottom-right-radius: 7.5rem 2.5rem;
border-bottom-left-radius: 7.5rem 2.5rem;
}
.phone {
width: 4.125em;
height: 8.750em;
position: absolute;
top: 15.75em;
left: 1em;
#include border-radius(0.5em);
background: #1f1f1f;
border: 1.563em solid #1f1f1f;
border-left: 0.313em solid #1f1f1f;
border-right: 0.313em solid #1f1f1f;
}
.phone:before,
.phone:after {
content: "";
position: absolute;
left: 50%;
background: #474e5d;
}
.phone:before {
background: #474e5d;
width: 1.250em;
height: 0.250em;
margin-left: -0.625em;
top: -0.75em;
#include border-radius(2px);
}
.phone:after {
width: 0.625em;
height: 0.625em;
#include border-radius(0.625em);
bottom: -1.125em;
margin-left: -0.313em;
}
.phone .screenz {
width: 3.50em;
height: 5.625em;
margin: 0 auto;
position: relative;
overflow: hidden;
background: #fff;
}
.ipad {
width: 8.75em;
height: 12.750em;
position: absolute;
top: 11.7em;
left: 6em;
#include border-radius(0.5em);
background: #1f1f1f;
border: 1.563em solid #1f1f1f;
border-left: 0.313em solid #1f1f1f;
border-right: 0.313em solid #1f1f1f;
}
.ipad:before,
.ipad:after {
content: "";
position: absolute;
left: 50%;
background: #474e5d;
}
.ipad:before {
background: #474e5d;
width: 1.250em;
height: 0.250em;
margin-left: -0.625em;
top: -0.75em;
#include border-radius(2px);
}
.ipad:after {
width: 0.625em;
height: 0.625em;
#include border-radius(0.625em);
bottom: -1.125em;
margin-left: -0.313em;
}
.ipad .screenz {
width: 8em;
height: 9.8em;
margin: 0 auto;
position: relative;
overflow: hidden;
background: #fff;
}
.ipad .content {
width: 100%;
left: 0%;
margin-left: 0px;
}
.monitor , .laptop, .ipad, .phone {
overflow: hidden;
img {
padding: 0 !important;
width: 100%;
height: 880px;
-webkit-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-moz-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-ms-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
-o-animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
animation:scroll 4s 1s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
&:hover {
opacity: 1 !important;
}
}
}
#media screen and (min-width: 38em) {
.service-graphic {
font-size: 12px;
.monitor {
border: 1.25em solid #1f1f1f;
}
}
}
Original unmodified codepen :
http://codepen.io/nicholaspetersen/pen/BHjfk
So what I did was, I converted the LESS to CSS (since I do not know LESS) using
http://less2css.org/
The animation worked perfectly for Firefox, however on Chrome it did not. So I went through the code and added all the missing prefixes, as you can see in the CSS code I provided and it still does not work. I am now clueless, why will this work on Firefox but not Chrome?
Thanks
It's not enough to just add the prefixed transformations inside of a keyframe animation, you need to prefix the keyframe declaration itself as well. For example:
#-webkit-keyframes foo {
0% {
-webkit-transform: scale(0);
}
100% {
-webkit-transform: scale(1);
}
}
Also worth noting, you can view the compiled LESS in codepen by clicking on the 'eye' icon in the CSS pane. Hope this helps bud