I have 3 diferent divs and I want to "glue" them together. When I say glue them, I mean that I want to make one shape out of it. Here is my css and html code (with bootstrap):
#keyframes fillin {
0% {
height: var(--beginHeight);
}
100% {
height: var(--endHeight);
}
}
.wrapper {
white-space: nowrap;
}
.wrapper > div {
display: inline-block;
float: left;
}
.wrapper > div:before {
background-color: blue;
}
#NadrzFrontView:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 300px;
height: 0;
background-color: blue;
display: inline-block;
}
#NadrzFrontView {
width: 300px;
height: 300px;
border-radius: 50%;
border: 5px solid black;
position: relative;
overflow: hidden;
}
#NadrzDnoLevo:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 300px;
height: 0;
}
#NadrzDnoLevo {
position: relative;
overflow: hidden;
border: 5px solid black;
height: 300px;
width: 150px;
border-radius: 300px 0 0 300px;
}
#NadrzDnoPravo:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 150px;
height: 0;
}
#NadrzDnoPravo {
position: relative;
overflow: hidden;
border: 5px solid black;
height: 300px;
width: 150px;
border-radius: 0 300px 300px 0;
}
#NadrzLuby:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 500px;
height: 0;
}
#NadrzLuby {
position: relative;
overflow: hidden;
border: 5px solid black;
border-left-width: 0px;
border-right-width: 0px;
height: 300px;
width: 500px;
}
<div class="row">
<div class="col-lg-3">
<div id="NadrzFrontView" style="--startHeight: 0%; --finishHeight: 50%"></div>
</div>
<div class="col-lg-9 wrapper">
<div id="NadrzDnoLevo" style="--startHeight: 0%; --finishHeight: 50%"></div>
<div id="NadrzLuby" style="--startHeight: 0%; --finishHeight: 50%"></div>
<div id="NadrzDnoPravo" style="--startHeight: 0%; --finishHeight: 50%"></div>
</div>
</div>
It does work pretty well, until I try it on mobile. Here is how it looks normally.
My problem comes when I try it on mobile where it looks like this:
As you can see, on mobile it looks horrible. I just want to somehow glue NadrzDnoLevo, NadrzLuby and NadrzDnoPravo together. Is it possible? Thanks for any help.
You need to get rid of float: left, and you can use flexbox to make them stay side by side and not wrapping to the next line by adding these rules to the .wrapper:
.wrapper {
display: flex;
flex-wrap: nowrap;
}
Also, on top of that, you can add
flex: 0 0 150px;
to #NadrzDnoLevo and NadrzDnoPravo and add
flex: 0 1 500px;
to #NadrzLuby to make the capsule keep its shape.
#keyframes fillin {
0% {
height: var(--beginHeight);
}
100% {
height: var(--endHeight);
}
}
.wrapper {
display: flex;
flex-wrap: nowrap;
}
.wrapper > div:before {
background-color: blue;
}
#NadrzFrontView:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 300px;
height: 0;
background-color: blue;
display: inline-block;
}
#NadrzFrontView {
width: 300px;
height: 300px;
border-radius: 50%;
border: 5px solid black;
position: relative;
overflow: hidden;
}
#NadrzDnoLevo:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 300px;
height: 0;
}
#NadrzDnoLevo {
position: relative;
overflow: hidden;
border: 5px solid black;
height: 300px;
flex: 0 0 150px;
border-radius: 300px 0 0 300px;
}
#NadrzDnoPravo:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 150px;
height: 0;
}
#NadrzDnoPravo {
position: relative;
overflow: hidden;
border: 5px solid black;
height: 300px;
flex: 0 0 150px;
border-radius: 0 300px 300px 0;
}
#NadrzLuby:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 500px;
height: 0;
}
#NadrzLuby {
position: relative;
overflow: hidden;
border: 5px solid black;
border-left-width: 0px;
border-right-width: 0px;
height: 300px;
flex: 0 1 500px;
}
<div class="row">
<div class="col-lg-3">
<div id="NadrzFrontView" style="--startHeight: 0%; --finishHeight: 50%"></div>
</div>
<div class="col-lg-9 wrapper">
<div id="NadrzDnoLevo" style="--startHeight: 0%; --finishHeight: 50%"></div>
<div id="NadrzLuby" style="--startHeight: 0%; --finishHeight: 50%"></div>
<div id="NadrzDnoPravo" style="--startHeight: 0%; --finishHeight: 50%"></div>
</div>
</div>
one div solution to easy handle it:
.box {
--w: 50%; /* height of the blue coloration */
--h:200px; /* Height of the element */
height: var(--h);
max-width: 400px;
margin: 20px 0;
border-radius: var(--h);
border: 3px solid;
background:
linear-gradient(#000,#000) left calc(var(--h)/2) top 0/3px 100%,
linear-gradient(#000,#000) right calc(var(--h)/2) top 0/3px 100%,
linear-gradient(blue,blue) bottom/100% var(--w);
background-repeat:no-repeat;
transition:1s;
}
.box.hide {
-webkit-mask:
linear-gradient(#fff,#fff)
center/calc(100% - var(--h)) 200%
padding-box border-box no-repeat;
margin:20px calc(-1*var(--h)/2);
}
.box:hover {
--w:80%;
}
<div class="box"></div>
<div class="box hide"></div>
#keyframes fillin {
0% {
height: var(--beginHeight);
}
100% {
height: var(--endHeight);
}
}
.wrapper {
white-space: nowrap;
}
.wrapper > div {
display: inline-block;
float: left;
}
.wrapper > div:before {
background-color: blue;
}
#NadrzFrontView:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 300px;
height: 0;
background-color: blue;
display: inline-block;
}
#NadrzFrontView {
width: 300px;
height: 300px;
border-radius: 50%;
border: 5px solid black;
position: relative;
overflow: hidden;
}
#NadrzLuby:before {
--beginHeight: var(--startHeight);
--endHeight: var(--finishHeight);
animation: 3s fillin ease forwards;
content: '';
position: absolute;
bottom: 0;
width: 800px;
height: 0;
}
#NadrzLuby {
--var-height:300;
position: relative;
overflow: hidden;
border: 5px solid black;
border-radius: calc(var(--var-height) * 0.5px);
height: calc(var(--var-height) * 1px);
width: 800px;
}
.line-left {
position: absolute;
left: calc(var(--var-height) * 0.5px);
top: 0;
bottom: 0;
border: 2.5px solid black;
}
.line-right {
position: absolute;
right: calc(var(--var-height) * 0.5px);
top: 0;
bottom: 0;
border: 2.5px solid black;
}
<div class="row">
<div class="col-lg-3">
<div id="NadrzFrontView" style="--startHeight: 0%; --finishHeight: 50%"></div>
</div>
<div class="col-lg-9 wrapper">
<div id="NadrzLuby" style="--startHeight: 0%; --finishHeight: 50%">
<span class="line-left"></span>
<span class="line-right"></span>
</div>
</div>
</div>
Related
I'd like to be able to have the div shine-box go across the image automatically from the top left ever like 3 seconds, left to right, left to right etc.
This is the current code:
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: darkblue;
}
img {
border: 0;
}
.shine-box {
position: absolute;
width: 200px height: 200px;
overflow: hidden;
border-radius: 40%;
}
.shine-box:before {
position: absolute;
top: 0;
left: -500px;
content: "";
width: 120px;
height: 500px;
background: rgba(255, 255, 255, 0.6);
transform: skew(-50deg);
transition: 1s;
}
.shine-box:hover:before {
left: 655px;
}
<div class="shine-box">
<img class="neko" src="neko-fin.png" alt="neko.png">
</div>
Is this something you are looking for. As #Pete suggested you have to use CSS animation instead of transition
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: darkblue;
}
img {
border: 0;
width: 100%;
}
.shine-box {
position: absolute;
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 40%;
}
.shine-box:before {
position: absolute;
top: 0;
left: -500px;
content: "";
width: 120px;
height: 500px;
background: rgba(255, 255, 255, 0.6);
transform: skew(-50deg);
/* transition: 1s; */
animation: shine 3s ease infinite;
}
#keyframes shine {
from {left: -500px;}
to {left: 655px;}
}
/* .shine-box:hover:before {
left: 655px;
} */
<div class="shine-box">
<img class="neko" src="data:image/jpeg;base64,/9j/4AAQSk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rGi9LVVNMb31WPEsfd1cwcAO6yh1GF4tDfVnpagbhIyaB3i5pcPgtw8m2SraqGQ7BfuIRGHmqsQH1uHxv5xTxO+EjWqG+uk34O8nkaA/zrYTwy72O8ioxhf7rvIoM5FiNQPq8L1eGvJSN/wCUlPNrcVfkIaWHgXyTSkfha1o+KvRTvOxjvJydZh8x2Md45fNBnP6urZPr654G9lKxkLT+I6z/ACIUiiwKmhOs2O8n6WUukkP43klaOPBZTt1W95v8lNhwNg9dxdyGQ/NBQtaSbAXPAKxpMHkdm/sjn63luV7DTsZkxoHdt806hEelo2RDsjPe45k+KkIQihCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIBCEIP/Z" alt="neko.png">
</div>
I am trying to create a skill bar where the background color of the progress slides in but the label for the Skill bar stays in the same place.
.skill-container * {
box-sizing: border-box;
}
.skill-container {
width: 100%;
border-radius: 5px;
background-color: lightgray;
margin: 20px 0;
overflow: hidden;
}
.skill-container .skill {
display: inline-block;
text-align: left;
color: white;
padding: 10px 0 10px 4px;
border-radius: inherit;
background-color: #312E81;
white-space: nowrap;
position: relative;
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
left: -100%
}
to {
left: 0
}
}
.skill-container .skill.skill-level-70 {
width: 70%
}
<div class="skill-container">
<span class="skill skill-level-70">CSS</span>
</div>
So far the animation works well, but the only thing I need to figure out is how to keep the text (CSS) on the left and animate the sliding of the background color to show the progress
Use a pseudo element for the background:
.skill-container .skill {
color: white;
background-color: lightgray;
margin: 5px 0;
padding: 10px 0 10px 4px;
overflow: hidden;
border-radius: 5px;
white-space: nowrap;
position: relative;
z-index:0;
}
.skill-container .skill::before {
content: "";
position: absolute;
background-color: #312E81;
border-radius: inherit;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
transform: translateX(-100%);
}
}
.skill-container .skill.skill-level-70::before {
width: 70%
}
.skill-container .skill.skill-level-40::before {
width: 40%
}
.skill-container .skill.skill-level-100::before {
width: 100%
}
<div class="skill-container">
<div class="skill skill-level-100">CSS</div>
<div class="skill skill-level-70">HTML</div>
<div class="skill skill-level-40">PHP</div>
</div>
You can optimize with CSS variables:
.skill-container .skill {
color: white;
background-color: lightgray;
margin: 5px 0;
padding: 10px 0 10px 4px;
overflow: hidden;
border-radius: 5px;
white-space: nowrap;
position: relative;
z-index:0;
}
.skill-container .skill::before {
content: "";
position: absolute;
background-color: #312E81;
border-radius: inherit;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
width:var(--l,0%);
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
transform: translateX(-100%);
}
}
<div class="skill-container">
<div class="skill" style="--l:100%">CSS</div>
<div class="skill" style="--l:70%">HTML</div>
<div class="skill" style="--l:40%">PHP</div>
</div>
I am creating a loader animation and I have achieved something like this below:
I want the black line to move from, left -> right and then right -> left infinitely. Right now, it's only moving in one direction.
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1s infinite;
}
#keyframes line-bounce {
from {
left: 300px;
}
to {
left: 0;
}
}
<div class="loader">
<div class="blue-line"></div>
</div>
Use #keyframes with % 0/50/100 to back it use 100%{left: 300px;}
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1s infinite;
}
#keyframes line-bounce {
0%{
left: 300px;
}
50%{
left: 0;
}
100%{
left: 300px;
}
}
<div class="loader">
<div class="blue-line"></div>
</div>
Or, you can use only
50% {
left: 300px;
}
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1.6s infinite;
}
#keyframes line-bounce {
50% {
left: 300px;
}
}
<div class="loader">
<div class="blue-line"></div>
</div>
Hope this helps you thanks. if you want to lear more about keyframe then visit below link. thanks
https://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1s infinite;
}
#keyframes line-bounce {
0% {left: 0px;}
50% {left: 300px;}
100% {left: 0px;}
}
<div class="loader">
<div class="blue-line"></div>
</div>
An easier way is to simply add alternate to the animation and also adjust it like below to avoid using pixel values:
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
margin:10px 0;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1s infinite alternate;
}
#keyframes line-bounce {
from {
left: 100%;
transform:translateX(-100%);
}
to {
left: 0;
transform:translateX(0);
}
}
<div class="loader">
<div class="blue-line"></div>
</div>
<div class="loader" style="width:500px">
<div class="blue-line"></div>
</div>
<div class="loader" style="width:200px">
<div class="blue-line"></div>
</div>
Thanks #לבני מלכה, I just made few changes to make it look more smoother.
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1.6s infinite;
}
#keyframes line-bounce {
0% {
left: 300px;
}
50% {
left: 0;
}
100% {
left: 300px;
}
}
<div class="loader">
<div class="blue-line"></div>
</div>
Try it: fiddle
HTML:
<div class="loader_trak">
<div class="loader_bar">
</div>
</div>
CSS:
.loader_trak {
position: relative;
height: 10px;
background-color: #ccc;
width: 250px;
}
.loader_bar {
background-color: #333;
position: absolute;
height: 100%;
width: 80px;
animation: line-bounce 1s infinite;
}
#keyframes line-bounce {
0% {
left: 0;
}
50% {
left: calc(100% - 80px);
}
100%{
left: 0;
}
}
You can use the following code for the same
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<style type="text/css">
.loader {
background: #ccc;
width: 400px;
height: 10px;
border-radius: 10px;
position: relative;
}
.loader .blue-line {
background: #000;
border-radius: 10px;
position: absolute;
left: 0;
z-index: 1;
width: 100px;
height: 10px;
animation: line-bounce 1s infinite;
}
#keyframes line-bounce {
0% {
left: 0px;
}
50% {
left: 300px;
}
100% {
left: 0px;
}
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="loader">
<div class="blue-line"></div>
</div>
</div>
</div>
</body>
</html>
Hi I have two divs side by side - but when I change to mobile view they overlap, how can I stop this? Codepen - https://codepen.io/MarkHarrison/pen/NXNGgJ Thanks
box {
position: absolute !important;
left: 0;}
iframe{
border:10px solid transparent;
border-image-source:url(https://i.imgur.com/91tJ1qi.png);
border-image-slice:10;
width:500px;
height:300px;
display:block;
margin:auto;
}
.box {
position: relative;
margin: 0px;
display: block;
width: 600px;
height: 420px;
margin-top: 15%;
You may simply remove the .box class where there is the absolute position and let bootstrap restruct the content on small screens :
h1,
h2 {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
}
h2 {
padding-bottom: 100px;
}
body {
background: #2B2B2B;
}
.neon {
color: #fff;
text-shadow: 0 0 5px #F5D5D5, 0 0 10px #F2A7A7, 0 0 20px #F58484, 0 0 40px #FC5858, 0 0 80px #FF0F0F, 0 0 90px #F5D5D5, 0 0 100px #F2A7A7, 0 0 150px #F58484;
}
iframe {
border: 10px solid transparent;
border-image-source: url(https://i.imgur.com/91tJ1qi.png);
border-image-slice: 10;
width: 500px;
height: 300px;
display: block;
margin: auto;
}
.box {
position: relative;
margin: 0px;
display: block;
width: 600px;
height: 420px;
margin-top: 15%;
}
.face {
position: absolute;
height: 70%;
width: 40%;
left: 30%;
background: #CD853F;
border-radius: 50% 50% 50% 50% / 80% 80% 40% 40%;
}
.face-copy {
position: absolute;
height: 100%;
width: 100%;
background: #CD853F;
border-radius: 50% 50% 50% 50% / 80% 80% 40% 40%;
z-index: 2;
}
.ear-left {
position: absolute;
width: 15%;
height: 20%;
left: 5%;
background: #CD853F;
border-radius: 50% 50% 50% 50% / 50% 50% 90% 90%;
transform: rotate(-60deg);
z-index: 1;
}
.ear-right {
position: absolute;
width: 15%;
height: 20%;
left: 80%;
background: #CD853F;
border-radius: 50% 50% 50% 50% / 50% 50% 90% 90%;
transform: rotate(60deg);
z-index: 1;
}
.ear-inner {
bottom: 20%;
margin-top: 30%;
background: #8B4513;
width: 35%;
height: 80%;
margin-left: 32%;
border-radius: 70% 70%;
}
.eye-left {
position: absolute;
background: white;
width: 15%;
height: 13%;
left: 30%;
top: 30%;
z-index: 2;
border-radius: 50%;
}
.eye-right {
background: white;
width: 15%;
height: 13%;
position: absolute;
left: 55%;
top: 30%;
z-index: 2;
border-radius: 50%;
}
.eye-left-inner,
.eye-right-inner {
background: black;
width: 70%;
height: 70%;
border-radius: 50%;
margin-top: 25%;
z-index: 3;
}
.eye-left-inner {
margin-left: 20%;
}
.eye-right-inner {
margin-left: 10%;
}
.pupil {
position: absolute;
background: white;
width: 30%;
height: 30%;
z-index: 4;
border-radius: 50%;
left: 35%;
}
.nose {
position: absolute;
background: #603311;
width: 50%;
height: 30%;
border-radius: 50%;
margin-left: 25%;
z-index: 4;
margin-top: 65%;
}
.inner-nose {
position: absolute;
width: 85%;
margin-top: 1%;
height: 90%;
background: #8B4513;
border-radius: 50%;
border-top-right-radius: 45%;
transform: rotate(-10deg)
}
.horn-left,
.horn-right {
position: absolute;
margin-left: 15%;
margin-top: -80%;
width: 10%;
height: 80%;
background: #8B4513;
transform: rotate(-20deg);
border-radius: 70% 70% 50% 50% / 50% 50% 50% 50%;
}
.horn-left-bottom,
.horn-left-top,
.horn-left-middle,
.horn-right-bottom,
.horn-right-middle,
.horn-right-top {
background: #8B4513;
position: absolute;
width: 90%;
height: 35%;
transform: rotate(60deg);
margin-top: 500%;
margin-left: 108%;
border-radius: 0.5em 2em 0.5em 2em;
}
.horn-left-top {
margin-top: 20%;
}
.horn-left-middle {
transform: rotate(-60deg);
margin-top: 250%;
margin-left: -110%;
}
.horn-right {
margin-left: 75%;
transform: rotate(21deg);
}
.horn-right-bottom,
.horn-right-top {
background: #8B4513;
transform: rotate(-60deg);
margin-left: -110%;
border-radius: 2em 0.5em 0.5em 2em;
}
.horn-right-top {
margin-top: 20%;
}
.horn-right-middle {
margin-top: 250%;
}
.box {
-webkit-animation: mymove 5s;
/* Safari 4.0 - 8.0 */
animation: mymove 5s;
}
/* Safari 4.0 - 8.0 */
#-webkit-keyframes mymove {
0% {
top: 0px;
}
25% {
top: 200px;
}
75% {
top: 50px
}
100% {
top: 100px;
}
}
/* Standard syntax */
#keyframes mymove {
0% {
top: 0px;
}
25% {
top: 200px;
}
50% {
top: 50px;
}
75% {
top: 150px
}
100% {
top: 0px;
}
}
-moz-animation: cssAnimation 0s ease-in 5s forwards;
/* Firefox */
-webkit-animation: cssAnimation 0s ease-in 5s forwards;
/* Safari and Chrome */
-o-animation: cssAnimation 0s ease-in 5s forwards;
/* Opera */
animation: cssAnimation 0s ease-in 5s forwards;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container-fluid">
<div class="row">
<h1 class="neon">Welcome to TLW Christmas Countdown</h1>
<h2 class="neon">You Will be taken to your deal shortly!</h2>
</div>
<div class="row">
<div class="col-md-4 blue">
<!--Reindeer-->
<div class="box">
<!--Head -->
<div class="face">
<div class="face-copy"></div>
<div class="ear-left">
<div class="ear-inner"></div>
</div>
<div class="ear-right">
<div class="ear-inner"></div>
</div>
<div class="eye-left">
<div class="eye-left-inner">
<div class="pupil"></div>
</div>
</div>
<div class="eye-right">
<div class="eye-right-inner">
<div class="pupil"></div>
</div>
</div>
<div class="nose">
<div class="inner-nose"></div>
</div>
<div class="horn-left">
<div class="horn-left-bottom"></div>
<div class="horn-left-middle"></div>
<div class="horn-left-top"></div>
</div>
<div class="horn-right">
<div class="horn-right-bottom"></div>
<div class="horn-right-middle"></div>
<div class="horn-right-top"></div>
</div>
<!-- Closing Face -->
</div>
<!-- Closing Box -->
</div>
</div>
<div class="col-md-4 yellow">
<!--Youtube-->
<div class="video" ;>
<iframe width="540" height="285" src="https://www.youtube.com/embed/iDNWwxJonII" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
I have a spinner with a white background which is animated through a keyframe. So, having this code pen, how could I remove this color to "smt-spinner-inner-circle" class without affecting the original desing? If the background is removed, the portion is visible. I have tried to apply a clip but the result is not the expected.
http://codepen.io/anon/pen/WpagJN
Html:
<div class="smt-spinner-circle">
<div class="smt-spinner"></div>
<div class="smt-spinner-inner-circle"></div>
</div>
To sum up, I need the background of the spinner transparent, not red, since the website will be different backgrounds depending on the page you are (grey, white, etc)...
Why not do like this, which will be transparent on top of any backgrounds, images included
.test {
display: inline-block;
padding: 20px;
}
.test.red{
background: red;
}
.test.green{
background: green;
}
.test.image{
background: url(http://lorempixel.com/500/200/nature/1/);
}
.smt-spinner-circle {
width: 50px;
height: 50px;
position: relative;
margin: 20px;
border-radius: 50%;
}
.smt-spinner {
height: 100%;
width: 100%;
border-radius: 50%;
border-right: 2px solid rgba(255,255,255,0.6);
border-top: 2px solid blue;
border-left: 2px solid blue;
border-bottom: 2px solid blue;
animation: rotate--spinner 1.6s infinite;
}
#keyframes rotate--spinner {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
<div class="test red">
<div class="smt-spinner-circle">
<div class="smt-spinner"></div>
</div>
</div>
<div class="test green">
<div class="smt-spinner-circle">
<div class="smt-spinner"></div>
</div>
</div>
<div class="test image">
<div class="smt-spinner-circle">
<div class="smt-spinner"></div>
</div>
</div>
Your background-color hides triangle that rotates, so simply change background: white to match your background color.
body{
background: red;
}
.smt-spinner-circle {
width: 50px;
height: 50px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
background: blue;
border-radius: 50%;
}
.smt-spinner-inner-circle {
width: 92%;
height: 92%;
background: red;
border-radius: 50%;
margin: auto;
vertical-align: middle;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.smt-spinner {
height: 0;
width: 0;
border-radius: 50%;
border-right: 25px solid rgba(255,255,255,0.6);
border-top: 25px solid transparent;
border-left: 25px solid transparent;
border-bottom: 25px solid transparent;
animation: rotate--spinner 1.6s infinite;
}
#keyframes rotate--spinner {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
<div class="smt-spinner-circle">
<div class="smt-spinner"></div>
<div class="smt-spinner-inner-circle"></div>
</div>
You could create a simple spinner with only one element and different border styles.
.loader{
border: 2px solid #CECECE;
border-top-color: #14B48C;
width: 40px;
height: 40px;
border-radius: 50%;
animation: spin 1s infinite;
}
#keyframes spin{
from{transform: rotate(0deg);}
to{transform: rotate(360deg);}
}
CSS Code
#keyframes ldio-rpinwye8j0b {
0% { transform: rotate(0deg) }
50% { transform: rotate(180deg) }
100% { transform: rotate(360deg) }
}
.ldio-rpinwye8j0b div {
position: absolute;
animation: ldio-rpinwye8j0b 1s linear infinite;
width: 160px;
height: 160px;
top: 20px;
left: 20px;
border-radius: 50%;
box-shadow: 0 4px 0 0 #e15b64;
transform-origin: 80px 82px;
}
.loadingio-eclipse {
width: 200px;
height: 200px;
display: inline-block;
overflow: hidden;
}
.ldio-rpinwye8j0b {
width: 100%;
height: 100%;
position: relative;
transform: translateZ(0) scale(1);
backface-visibility: hidden;
transform-origin: 0 0; /* see note above */
}
.ldio-rpinwye8j0b div { box-sizing: content-box; }
<div
class="loadingio-eclipse">
<div class="ldio-rpinwye8j0b">
<div>
</div>
</div>
</div>