CSS3 problem with animation when unchecking a checkbox - css

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.

Related

Add Loader/Spinner at center of a button

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;

Why are my CSS animation transitions not being applied to hamburger icon?

I have no idea why the transition is not being applied for an the animation of a hamburger menu.
I have tried to isolate the issue of why the transition is not being applied but I cannot see why.
#media only screen and (max-width: 763px) {
.menu-btn {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 60px;
height: 60px;
transition: all .5s ease-in-out;
}
.menu-btn-burger {
width: 50px;
height: 6px;
background: #fff;
border-radius: 5px;
box-shadow: 0px 2px 5px rgba(255, 101, 47, .2);
cursor: pointer;
transition: all .5 ease-in-out;
}
.menu-btn-burger::before,
.menu-btn-burger::after {
content: '';
position: absolute;
width: 50px;
height: 6px;
background: #fff;
border-radius: 5px;
box-shadow: 0px 2px 5px rgba(255, 101, 47, .2);
transition: all 0.5 ease-in-out;
}
.menu-btn-burger::before {
transform: translateY(-16px);
}
.menu-btn-burger::after {
transform: translateY(16px);
}
/* ANIMATION */
.menu-btn.open .menu-btn-burger {
transform: translateX(-50px);
background: transparent;
box-shadow: none;
}
.menu-btn.open .menu-btn-burger::before {
transform: rotate(45deg) translate(35px, -35px);
}
.menu-btn.open .menu-btn-burger::after {
transform: rotate(-45deg) translate(35px, 35px);
}
<nav>
<a href=# onclick="openMenu()" class="icon">
<div class="menu-btn">
<div class="menu-btn-burger">
</div>
</div>
</a>
</nav>

CSS loader spinner to add white divider between the donut parts

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

Toggle Switch lable

Im used Toggle Switch i need to put switch open and close label behind the switch , look image 01 and image 02 you can understand my issue,
this is a two type Open and closed Switch Open after displayed open Switch Closed after displayed Closed, please look the working snippet
how can i fix it,
please help me to fix this
Thanks
Image 01- current view
Image 02 - i need like this
.onoffswitch1 {
position: relative; width: 90px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch1-checkbox {
display: none;
}
.onoffswitch1-label {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 30px;
}
.onoffswitch1-inner {
display: block; width: 200%; margin-left: -100%;
-moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
-o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
}
.onoffswitch1-inner:before, .onoffswitch1-inner:after {
display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
border-radius: 30px;
box-shadow: 0px 15px 0px rgba(0,0,0,0.08) inset;
}
.onoffswitch1-inner:before {
content: "YES";
padding-left: 10px;
background-color: #2FCCFF; color: #FFFFFF;
border-radius: 30px 0 0 30px;
}
.onoffswitch1-inner:after {
content: "NO";
padding-right: 10px;
background-color: #EEEEEE; color: #999999;
text-align: right;
border-radius: 0 30px 30px 0;
}
.onoffswitch1-switch {
display: block; width: 30px; margin: 0px;
background: #FFFFFF;
border: 2px solid #999999; border-radius: 30px;
position: absolute; top: 0; bottom: 0; right: 56px;
-moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: -webkit-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: -o-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
box-shadow: 0 1px 1px white inset;
}
.onoffswitch1-checkbox:checked + .onoffswitch1-label .onoffswitch1-inner {
margin-left: 0;
}
.onoffswitch1-checkbox:checked + .onoffswitch1-label .onoffswitch1-switch {
right: 0px;
}
<div class="onoffswitch1">
<input type="checkbox" name="onoffswitch1" class="onoffswitch1-checkbox" id="myonoffswitch1" checked>
<label class="onoffswitch1-label" for="myonoffswitch1">
<span class="onoffswitch1-inner"></span>
<span class="onoffswitch1-switch"></span>
</label>
</div>
Please check if this is what you need. You may have to tweak the colors and the position of the text.
.onoffswitch1 {
width: 90px;
}
.onoffswitch1-checkbox {
display: none;
}
.onoffswitch1-label {
display: inline-block;
cursor: pointer;
border: 2px solid #999999;
border-radius: 30px;
width: 90px;
height: 2em;
background: darkgray;
position: relative;
margin-top: 2em;
}
.onoffswitch1-checkbox:checked + .onoffswitch1-label {
background: lightblue;
}
.onoffswitch1-checkbox:checked+.onoffswitch1-label:before {
content: "OPEN";
position: absolute;
top: -1.5em;
left: 0;
}
.onoffswitch1-checkbox+.onoffswitch1-label:before {
content: "CLOSED";
position: absolute;
top: -1.5em;
left: 0;
}
.onoffswitch1-switch {
display: block;
width: 30px;
margin: 0px;
background: #FFFFFF;
border: 2px solid #999999;
border-radius: 30px;
position: absolute;
top: 0;
bottom: 0;
right: 56px;
-moz-transition: all 0.3s ease-in 0s;
-webkit-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s;
transition: all 0.3s ease-in 0s;
background-image: -moz-linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 80%);
background-image: -webkit-linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 80%);
background-image: -o-linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 80%);
background-image: linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 80%);
box-shadow: 0 1px 1px white inset;
}
.onoffswitch1-checkbox:checked+.onoffswitch1-label .onoffswitch1-inner {
margin-left: 0;
}
.onoffswitch1-checkbox:checked+.onoffswitch1-label .onoffswitch1-switch {
right: 0px;
}
<div class="onoffswitch1">
<input type="checkbox" name="onoffswitch1" class="onoffswitch1-checkbox" id="myonoffswitch1" checked>
<label class="onoffswitch1-label" for="myonoffswitch1">
<span class="onoffswitch1-inner"></span>
<span class="onoffswitch1-switch"></span>
</label>
</div>
Try this.
<div class="switchcontainer">
<label class="switch"><input type="checkbox" id="togBtn"><div class="slider round"><span class="on">ON</span><span class="off">OFF</span></div></label>
</div>
.switchcontainer{
margin-top:25px;
}
.switchcontainer .on{
margin-top:-25px;
color:green;
}
.switchcontainer .off{
margin-top:-25px;
color:red;
}
.switch {
position: relative;
display: inline-block;
width: 90px;
height: 34px;
border: 2px solid #999999;
border-radius: 30px;
}
.switch input {display:none;}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #EEEEEE;
-webkit-transition: .4s;
transition: .4s;
box-shadow: 0px 15px 0px rgba(0,0,0,0.08) inset;
}
.slider:before {
content: "";
height: 30px;
width: 26px;
left: 0px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
display: block;
width: 30px;
margin: 0px;
background: #FFFFFF;
border: 2px solid #999999;
border-radius: 30px;
position: absolute;
top: 0;
bottom: 0;
right: 56px;
-moz-transition: all 0.3s ease-in 0s;
-webkit-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s;
transition: all 0.3s ease-in 0s;
background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: -webkit-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: -o-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
background-image: linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%);
box-shadow: 0 1px 1px white inset;
}
input:checked + .slider {
background-color: #2FCCFF;
box-shadow: 0px 15px 0px rgba(0,0,0,0.08) inset;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(55px);
-ms-transform: translateX(55px);
transform: translateX(55px);
}
/*------ ADDED CSS ---------*/
.on
{
display: none;
}
.on, .off
{
color: white;
position: absolute;
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
font-size: 10px;
font-family: Verdana, sans-serif;
}
input:checked+ .slider .on
{display: block;}
input:checked + .slider .off
{display: none;}
/*--------- END --------*/
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
https://jsfiddle.net/gnanavelr/8LqLczyh/1/
I create a switch button for you check this out
this is the html
<div class="switch">
<input class="toggle" id="toggle-1" type="checkbox" >
<label class="c-label-switch" for="toggle-1"></label>
<label class="c-label" for="toggle-1">Remember password </label>
</div>
and this is the css
.switch {
display: block;
}
.switch span {
display: inline-block;
color: #141414;
margin-top: 0px;
font-size: 14px;
font-weight: bold;
}
.switch .c-label {
padding: 0px;
vertical-align: middle;
}
.toggle {
position: absolute;
margin-left: -9999px;
visibility: hidden;
}
.toggle + label {
display: inline-block;
position: relative;
cursor: pointer;
border-radius: 15px;
width: 70px;
height: 30px;
overflow: hidden;
line-height: 4px;
margin-bottom: 0px;
vertical-align: middle;
margin-right: 10px;
}
.c-label-switch {
border: 1px solid #d1d1d1;
}
.toggle + label:before, .toggle + label:after {
display: block;
border-radius: 20px;
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
padding: 12px 12px 12px 9px;
color: #FFF;
font-family: 'Source Sans Pro';
}
.toggle + label:before {
content: "No";
right: 0px;
background-color: #ddd;
text-indent: -93px;
margin-left: 0px;
line-height: 5px;
font-size: 10px;
}
.toggle + label:after {
content: "Yes";
text-indent: 35px;
width: 6px;
background-color: #fff;
margin: 1px;
text-shadow: 0 1px 0 #fff;
margin-left: 1px;
font-size: 10px;
color: #141414;
}
.toggle:checked + label:before {
background-color: #0065b3;
text-indent: 0;
}
.toggle:checked + label:after {
margin-left: 41px;
box-shadow: none;
}
.toggle + label:before, .toggle + label:after {
transition: All 0.5s ease;
-webkit-transition: All 0.5s ease;
-moz-transition: All 0.5s ease;
-o-transition: All 0.5s ease;
}

Customize Radio and Checkbox with CSS [duplicate]

This question already has answers here:
How to style a checkbox using CSS
(43 answers)
Closed 7 years ago.
Is it possible to customize the look of radio and checkboxes only using CSS? I see there is a lot out there regarding this, but most solutions require the use of images and javascript.
Looks like the guys at bootswatch.com do a nice job of customizing inputs with pure CSS. I simplified their approach on the fiddle here:
https://jsfiddle.net/mthomas9261/qujbq4gs/
HTML:
<input type="radio" value="a" name="test">
<input type="radio" value="b" name="test">
<input type="checkbox" name="a" value="a">
<input type="checkbox" name="b" value="b">
CSS:
/*****************************************************
****************** Radio *****************
******************************************************/
/* Hide Original Radio Button */
input[type="radio"] {
position: relative;
margin-top: 6px;
margin-right: 4px;
vertical-align: top;
border: none;
background-color: transparent;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
/* Remove standard blue selection outline */
input[type="radio"]:focus {
outline: none;
}
/* New radio button */
input[type="radio"]:before,
input[type="radio"]:after {
content: "";
display: block;
width: 14px;
height: 14px;
border-radius: 50%;
-webkit-transition: 240ms;
-o-transition: 240ms;
transition: 240ms;
}
input[type="radio"]:before {
position: absolute;
left: 1px;
top: -2px;
background-color: red;
-webkit-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
}
input[type="radio"]:after {
position: relative;
top: -3px;
border: 1px solid #E0E0E0;
}
/* New radio checked */
input[type="radio"]:checked:before {
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
-o-transform: scale(0.5);
transform: scale(0.5);
}
input[type="radio"]:checked:after {
border-color: #E0E0E0;
}
/* New radio disabled */
input[type="radio"]:disabled:after,
input[type="radio"]:disabled:checked:after {
border-color: #F1F1F1;
}
input[type="radio"]:disabled:checked:before {
background-color: #F1F1F1;
}
/*****************************************************
**************** Checkbox ****************
******************************************************/
/* Hide Original Checkbox */
input[type="checkbox"] {
position: relative;
border: none;
margin-bottom: -4px;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
/* Display New Checkox */
input[type="checkbox"] {
position: relative;
border: none;
margin-bottom: -4px;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
input[type="checkbox"]:focus,
.checkbox input[type="checkbox"]:focus,
.checkbox-inline input[type="checkbox"]:focus {
outline: none;
}
input[type="checkbox"]:focus:after,
.checkbox input[type="checkbox"]:focus:after,
.checkbox-inline input[type="checkbox"]:focus:after {
border-color: #E0E0E0;
}
input[type="checkbox"]:after,
.checkbox input[type="checkbox"]:after,
.checkbox-inline input[type="checkbox"]:after {
content: "";
display: block;
width: 14px;
height: 14px;
margin-top: -2px;
margin-right: 5px;
border: 1px solid #E0E0E0;
border-radius: 1px;
-webkit-transition: 240ms;
-o-transition: 240ms;
transition: 240ms;
}
/* Checkbox Checked */
input[type="checkbox"]:checked:before {
content: "";
position: absolute;
top: -2px;
left: 5px;
display: table;
width: 4px;
height: 9px;
border: 3px solid red;
border-top-width: 0;
border-left-width: 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
input[type="checkbox"]:checked:after {
border-color: #E0E0E0;
}
/* Checkbox Disabled */
input[type="checkbox"]:disabled:after {
border-color: #F1F1F1;
}
input[type="checkbox"]:disabled:checked:after {
background-color: #F1F1F1;
border-color: transparent;
}

Resources