I am trying to add some white dividers between blue and black. Please see the GIF animation below. Please edit my CSS in jsbin to mimic the same animation in the image. I only need CSS version of this animation without SVG or JS.
.spinner {
height:60px;
width:60px;
animation: rotation 10s infinite linear;
border-left:7px solid rgba(0,0,0,1);
border-right:7px solid rgba(0,0,0,1);
border-bottom:7px solid rgba(0,174,239,1);
border-top:7px solid rgba(0,174,239,1);
border-radius: 100%;
}
#keyframes rotation {
from {transform: rotate(0deg);}
to {transform: rotate(359deg);}
}
http://jsbin.com/ziniwexuwi/edit?html,css,output
Please check the updated code. I hope it works well for you.
.spinner {
height:62px;
width:62px;
border-left:7px solid rgba(0,0,0,1);
border-right:7px solid rgba(0,0,0,1);
border-bottom:7px solid rgba(0,174,239,1);
border-top:7px solid rgba(0,174,239,1);
border-radius: 100%;
border-spacing: 1px;
position: relative;
animation: rotation 1s infinite linear;
}
.spinner span {
height: 7px;
width: 2px;
background: #fff;
position: absolute;
z-index: 1;
}
.spinner .a {
left: 6px;
top:3px;
transform: rotate(-47deg);
}
.spinner .b {
right: 6px;
top:3px;
transform: rotate(47deg);
}
.spinner .c {
left: 6px;
bottom: 3px;
transform: rotate(47deg);
}
.spinner .d {
right: 6px;
bottom: 3px;
transform: rotate(-47deg);
}
#keyframes rotation {
from {transform: rotate(0deg);}
to {transform: rotate(359deg);}
}
<div class="spinner">
<span class="a"></span>
<span class="b"></span>
<span class="c"></span>
<span class="d"></span>
</div>
Check this for your perfect requirement:
.loaderborder {
position: relative;
display: inline-block;
border: 16px solid #87ceeb;
border-radius: 50%;
border-top: 16px solid #000;
border-right: 16px solid #87ceeb;
border-bottom: 16px solid #000;
width: 100px;
height: 100px;
-webkit-animation: loaderborder 2.5s linear infinite;
animation: loaderborder 2.5s linear infinite;
}
.loaderborder:before{
content: '';
border-left: 16px solid #fff;
width: 0;
height: 9px;
border-radius: 0%;
display: inline-block;
transform: rotate(50deg);
}
.loaderborder:after{
content: '';
border-right: 16px solid #fff;
width: 0;
height: 9px;
border-radius: 0;
display: inline-block;
transform: rotate(-52deg);
position: absolute;
right: 0;
top: 5px;
}
.loaderborder span{
display: inline-block;
}
.loaderborder span:before{
content: '';
border-top: 16px solid #fff;
width: 10px;
height: 9px;
border-radius: 0%;
display: inline-block;
transform: rotate(50deg);
position: absolute;
z-index: 999;
top: 78px;
left: -2px;
}
.loaderborder span:after{
content: '';
border-bottom: 16px solid #fff;
width: 9px;
height: 9px;
border-radius: 0;
display: inline-block;
transform: rotate(-52deg);
position: absolute;
z-index: 9999;
top: 73px;
left: 85px;
}
#-webkit-keyframes loaderborder {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
#keyframes loaderborder {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
<div class="loaderborder"><span></span></div>
You can also check this Fiddle
Related
How do I add the green shadow effect that connected to the moving vertical line.
See the image for an example of what I am aiming for.
How can I implement this in CSS?
Here is the example that I have implemented
body {
height: 100vh;
position: relative;
}
.ocrloader p::before {
content: '';
display:inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
background: #18c89b;
position: relative;
right: 4px;
}
.ocrloader p {
color: #18c89b;
position: absolute;
bottom: -30px;
left: 38%;
font-size: 16px;
font-weight: 600;
animation: blinker 1.5s linear infinite;
font-family: sans-serif;
text-transform: uppercase;
}
.ocrloader {
width: 360px;
height: 225px;
position: absolute;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
top: 40%;
backface-visibility: hidden;
}
.ocrloader span {
position: absolute;
left: 35px;
top: 0;
width: 85%;
height: 5px;
background-color: #18c89b;
box-shadow: 0 0 10px 1px #18c89b,
0 0 1px 1px #18c89b;
z-index: 1;
transform: translateY(95px);
animation: move 1.7s cubic-bezier(0.15,0.54,0.76,0.74);
animation-iteration-count: infinite;
}
.ocrloader:before,
.ocrloader:after,
.ocrloader em:after,
.ocrloader em:before {
border-color: #18c89b;
content: "";
position: absolute;
width: 45px;
height: 46px;
border-style: solid;
border-width: 0px;
}
.ocrloader:before {
left: 0;
top: 0;
border-left-width: 5px;
border-top-width: 5px;
border-radius: 5px 0 0 0;
}
.ocrloader:after {
right: 0;
top: 0;
border-right-width: 5px;
border-top-width: 5px;
border-radius: 0 5px 0 0;
}
.ocrloader em:before {
left: 0;
bottom: 0;
border-left-width: 5px;
border-bottom-width: 5px;
border-radius: 0 0 0 5px;
}
.ocrloader em:after {
right: 0;
bottom: 0;
border-right-width: 5px;
border-bottom-width: 5px;
border-radius: 0 0 5px 0;
}
#keyframes move {
0%,
100% {
transform: translateY(190px);
}
50% {
transform: translateY(0%);
}
75% {
transform: translateY(160px);
}
}
#keyframes blinker {
50% { opacity: 0; }
}
<div class="ocrloader">
<p>Scanning</p>
<em></em>
<span></span>
</div>
Full example on CodePen
Here is an idea using box-shadow and clip-path
.box {
width:200px;
height:200px;
margin:20px;
outline:2px solid;
outline-offset:10px;
position:relative;
}
.box::before {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
width:20px;
background:#18c89b;
box-shadow:0 0 70px 20px #18c89b;
clip-path:inset(0);
animation:
x 0.5s ease-in-out infinite alternate,
y 1s ease-in-out infinite;
}
#keyframes x {
to {
transform:translateX(-100%);
left:100%;
}
}
#keyframes y {
33% {
clip-path:inset(0 0 0 -100px);
}
50% {
clip-path:inset(0 0 0 0);
}
83%{
clip-path:inset(0 -100px 0 0);
}
}
<div class="box">
</div>
I want to add a spinner at the center of my button using CSS.The spinner should load at the center everytime the width of button changes. If i set margins the spinner position remains same and it does not change with the button text and does not align to center.
My Output
Expected Output
.ic2-fa-spin-blue {
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
border: 3px solid #008ad6;
border-radius: 50%;
border-top: 3px solid #f3f3f3;
width: 20px;
height: 20px;
-webkit-animation: ic2-spin 2s linear infinite; /* Safari */
animation: ic2-spin 2s linear infinite;
-moz-animation: ic2-spin 2s infinite linear;
-o-animation: ic2-spin 2s infinite linear;
/*position: absolute;
/*margin-left:1em;*/
/*margin-top: 6px;
margin-right: auto;
margin-left: auto;*/
display: block;
position: absolute;
}
#-webkit-keyframes ic2-spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#keyframes ic2-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.ic2-outlined-spin-blue-btn {
color: #a3deff;
border: 1px solid #008ad6;
}
.ic2-outlined-btn {
border-radius: 3px;
background-color: var(--white-color);
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.05);
font-family: Roboto;
font-size: 17px;
font-weight: 500;
/*line-height: 32px;*/
text-align: var(--button-alignment);
padding: 0px 16px;
border-radius: 3px;
width: auto;
word-spacing: 8px;
height:32px;
}
<button value="Loading" class="ic2-outlined-btn ic2-outlined-spin-blue-btn ">
<span class=" ic2-fa-spin-blue"></span>
Loading
</button>
I want the spinner to load at center .
You can position the spinner using top: calc(50% - 13px); left: calc(50% - 13px);. The 50% is measured from the parent, and 13px since the width/height of the spinner is 20px and border adds 6px to a total of 26px, and half of it is 13px.
Also set position: relative on the button .ic2-outlined-spin-blue-btn, so it will be the positioning context (the parent).
.ic2-fa-spin-blue {
border: 3px solid #008ad6;
border-radius: 50%;
border-top: 3px solid #f3f3f3;
width: 20px;
height: 20px;
display: block;
position: absolute;
top: calc(50% - 13px);
left: calc(50% - 13px);
animation: ic2-spin 2s linear infinite;
}
#keyframes ic2-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.ic2-outlined-spin-blue-btn {
position: relative;
color: #a3deff;
border: 1px solid #008ad6;
}
.ic2-outlined-btn {
border-radius: 3px;
background-color: var(--white-color);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.05);
font-family: Roboto;
font-size: 17px;
font-weight: 500;
/*line-height: 32px;*/
text-align: var(--button-alignment);
padding: 0px 16px;
border-radius: 3px;
width: auto;
word-spacing: 8px;
height: 32px;
}
<button value="Loading" class="ic2-outlined-btn ic2-outlined-spin-blue-btn ">
<span class=" ic2-fa-spin-blue"></span>
Loading
</button>
Add position:relative to .ic2-outlined-btn class.
Add this style to .ic2-fa-spin-blue class.
right: calc(50% - 15px);
top: 2px;
The screenshot attached explains everything about the desired effect. I was thinking to decrease the border width from 4px to 3px to 2px , I don't want to apply ease-in/ease out effect. As of now, when I hover, it looks like this. I want to change this box through the effect displayed in the first screenshot.
For reference,
I am posting the code below:
&__link {
#include font-text(default, menuitem);
#include token(font-size, sidenav, default);
background-image: none;
text-transform: uppercase;
padding: 1rem;
margin: 0;
&:before {
position: absolute;
right: 1.3rem;
top: 2rem;
width: 1px;
content: '';
background: #fff;
height: 100%;
opacity: 0.3;
}
&:after {
display: inline-block;
vertical-align: middle;
position: relative;
content: '';
width: 10px;
height: 10px;
outline: 1px solid #fff;
top: -1px;
}
&:hover {
#include font-text(default, menuitem);
#include token(font-size, sidenav, hover);
font-weight: 600;
margin: 0;
padding: 1rem;
&:after {
background: white;
box-shadow: 0 0 10px 1px rgba(255, 255, 255, 1);
}
}
}
&:after represents the code for the box. Thanks in advance.
<div class="box">
</div>
.box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 200px;
width: 200px;
text-decoration: none;
background-color: white;
background-image: linear-gradient(#000, #000);
border: 1px solid black;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: 0% 0%;
transition: .5s;
}
.box:hover {
background-size: 95% 95%;
}
Didnt understand the question too well but this does the attached screenshot animation
Try it - you need to set animations, bcz you want several situations for single event (hover)
Replace these blocks
&:after {
display: inline-block;
vertical-align: middle;
position: relative;
content: '';
width: 0px;
height: 0px;
top: -1px;
background: white;
border: 7px solid #fff;
}
&:hover:after {
animation: sqr .3s linear;
animation-fill-mode: forwards;
}
#keyframes sqr {
30%{
border: 5.5px solid #fff;
width: 3px; height: 3px;
background: black;
}
80%{
border: 4px solid #fff;
width: 6px;
height: 6px;
background: black;
}
100%{
border: 3px solid #fff;
width: 8px;
height: 8px;
transform: scale(1.5);
box-shadow: 0 0 5px 2px #fff;
background: black;
}
}
I'm trying to recreate my form's checkboxes by CSS3.
I animated the mark (checkbox) correctly, but when I uncheck the checkbox I can't start the animation in reverse mode. I reproduced my example.
/*
==================
INPUT CHECKBOX
==================
*/
.checkbox-label>input {
display: none;
outline: none;
}
/*
==============
LABEL CHECKBOX
==============
*/
.checkbox-label {
display: block;
position: relative;
font-size: 0.95em;
margin-bottom: 10px;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
outline: none;
}
.checkbox-label:hover>.checkbox-button {
box-shadow: 0px 0px 0px 5px hsla(255, 100%, 60%, 0.1);
background-color: hsla(255, 100%, 60%, 0.1);
}
.checkbox-label:hover>.checkbox-button {
border: 2px solid #808080;
}
/*
======================
MARK CHECKBOX - AFTER
======================
*/
.checkbox-label>input[type="checkbox"]~.checkbox-button::after {
content: "";
position: absolute;
top: 8px;
left: 3px;
border-right: 2px solid transparent;
border-bottom: 2px solid transparent;
transform: rotate(45deg);
transform-origin: left bottom;
}
/*
================================
MARK CHECKBOX - AFTER - CHECKED
================================
*/
.checkbox-label>input[type="checkbox"]:checked~.checkbox-button::after {
animation: checkbox-check 0.3s cubic-bezier(0.5, 0, 0.23, 1);
animation-fill-mode: forwards;
animation-direction: normal;
}
.checkbox-label:not(:active)>input[type="checkbox"]:not(:checked)~.checkbox-button::after {
animation-direction: reverse;
}
/*
========
CHECKBOX
========
*/
.checkbox-button {
vertical-align: sub;
}
.checkbox-button {
position: relative;
top: 0px;
left: 0px;
color: #808080;
height: 20px;
width: 20px;
background-color: transparent;
border: 2px solid #ccc;
border-radius: 5px;
display: inline-block;
transition: background-color 0.4s ease;
}
.checkbox-label>input:checked~.checkbox-button {
background-color: transparent;
border: 2px solid #6633ff;
background-color: #6633ff;
}
.checkbox-label>input~.checkbox-button::before {
content: "";
position: absolute;
left: -8px;
top: -8px;
width: 35px;
height: 35px;
background-color: #6633ff;
border-radius: 30%;
opacity: 0.6;
transform: scale(0);
}
.checkbox-label>input:checked~.checkbox-button::before {
animation: ripple 0.9s ease-out;
}
/*
==========
ANIMATION
==========
*/
#keyframes ripple {
0% {
transform: scale(0);
}
50% {
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1);
}
}
#keyframes checkbox-check {
0% {
width: 0px;
height: 0px;
border-color: white;
transform: translate3d(0, 0, 0) rotate(45deg);
}
33% {
width: 5px;
height: 0px;
transform: translate3d(0, 0px, 0) rotate(45deg);
}
100% {
width: 5px;
height: 11px;
border-color: white;
transform: translate3d(0, -11px, 0) rotate(45deg);
}
}
<form action="" method="post" class="form">
<h1>Custom Checkboxe</h1>
<label class="checkbox-label" data-label="One">
<input type="checkbox" checked="checked" />
<span class="checkbox-button"></span>
One
</label>
</form>
Let me know what I'm doing wrong and how to improve to make my animation work properly.
I'm playing around trying to draw a simple folder icon with CSS, and this is where I'm at:
/* CSS */
.container {
border: solid 1px #000;
width: 100px;
height: 100px;
padding: 5px;
text-align: center;
}
.folder_tab, .folder {
margin: 0 auto;
background-color: #708090;
}
.folder_tab {
width: 25px;
height: 5px;
margin-right: 50%;
border-radius: 5px 15px 0 0;
}
.folder {
width: 50px;
height: 35px;
border-radius: 0 5px 5px 5px;
box-shadow: 1px 1px 0 1px #CCCCCC;
}
<!-- HTML -->
<div class="container">
<div class="folder_tab"></div>
<div class="folder"></div>
text
</div>
Result:
Is there a simpler, or more elegant way to do this?
This is my solution, if you want to use CSS3.
HTML
<div class="folder"></div>
CSS
.folder {
width: 150px;
height: 105px;
margin: 0 auto;
margin-top: 50px;
position: relative;
background-color: #708090;
border-radius: 0 6px 6px 6px;
box-shadow: 4px 4px 7px rgba(0, 0, 0, 0.59);
}
.folder:before {
content: '';
width: 50%;
height: 12px;
border-radius: 0 20px 0 0;
background-color: #708090;
position: absolute;
top: -12px;
left: 0px;
}
DEMO (tested in Chrome)
I know this thread is a bit old, but I bounced into this question by asking myself if there was something simple in pure CSS and minimalistic HTML to update my old tree library which uses background images for icons.
I tried by myself and I came up with something in line with the flat design which today is revolutioning cross-devices UI's:
https://jsfiddle.net/landzup/Lzjadp5r/
It is just a suggestion or a starting point, but it is amazing watching the page not losing a single pixel of resolution by zooming in as much as possible! (Just like vector graphics).
I used a brief HTML:
<div class="folder">
<div class="icon"></div>
Programming
</div>
And this is the CSS:
<style type="text/css">
.folder {
display: block;
position: relative;
top: 0;
left: 0;
margin: 18px 0;
font: 18px helvetica, arial, sans-serif;
text-indent: 27px;
line-height: 34px;
}
.folder .icon {
content: "";
display: block;
float: left;
position: relative;
top: 0;
left: 0;
width: 30px;
height: 30px;
border: 2px solid #999;
background: #ddd;
-moz-border-radius: 2px; -webkit-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px;
-moz-transform: scale(1) rotate(0deg) translateX(10px) skewX(10deg);
-webkit-transform: scale(1) rotate(0deg) translateX(10px) skewX(10deg);
-o-transform: scale(1) rotate(0deg) translateX(10px) skewX(10deg);
-ms-transform: scale(1) rotate(0deg) translateX(10px) skewX(10deg);
transform: scale(1) rotate(0deg) translateX(10px) skewX(10deg);
}
.folder .icon::after {
content: "";
display: block;
position: relative;
top: 7px;
left: -6px;
width: 30px; height: 21px;
border: 2px solid #999;
background: #ddd;
-moz-border-radius: 2px; -webkit-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px;
-moz-transform: scale(1) rotate(0deg) translateX(10px) skewX(-20deg);
-webkit-transform: scale(1) rotate(0deg) translateX(10px) skewX(-20deg);
-o-transform: scale(1) rotate(0deg) translateX(10px) skewX(-20deg);
-ms-transform: scale(1) rotate(0deg) translateX(10px) skewX(-20deg);
transform: scale(1) rotate(0deg) translateX(10px) skewX(-20deg);
}
</style>
It uses CSS 3 transformations, so you should consider your target audience to support its browsers.
Here there are CSS compatibility tables for CSS transformation:
http://caniuse.com/#feat=transforms2d
Here is my solution:
http://jsfiddle.net/wQdgs/
HTML
<div>text</div>
CSS
div {
width: 100px;
height: 50px;
padding-top: 50px;
border: solid 1px #000;
position: relative;
text-align: center;
}
div:after {
content: " ";
width: 50px;
height: 35px;
border-radius: 0 5px 5px 5px;
box-shadow: 1px 1px 0 1px #CCCCCC;
display: block;
background-color: #708090;
position: absolute;
top: 15px;
left: 25px;
}
div:before {
content: " ";
width: 25px;
height: 5px;
border-radius: 5px 15px 0 0;
display: block;
background-color: #708090;
position: absolute;
top: 10px;
left: 25px;
}