Checkbox CSS Animation

by mtambulut

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
    
<form action="">
    <label>
        <input type="checkbox" />
        <div><i class="fa fa-dribbble"></i></div>
    </label>
        
    <label>
        <input type="checkbox" checked />
        <div><i class="fa fa-jsfiddle"></i></div>
    </label>
    
    <label>
        <input type="checkbox" />
        <div><i class="fa fa-github"></i></div>
    </label>
    
    <label>
        <input type="checkbox" />
        <div><i class="fa fa-twitter"></i></div>
    </label>
</form>

SCSS

@mixin transform($transform){
  -moz-transform: $transform; /* FF3.6+ */
  -webkit-transform: $transform; /* Chrome, Safari */
  -o-transform: $transform; /* Opera */
  -ms-transform: $transform; /* IE 9 */
  transform: $transform;
}

@mixin transition($transition){
  -moz-transition: $transition; /* FF3.6+ */
  -webkit-transition: $transition; /* Chrome, Safari */
  -o-transition: $transition; /* Opera */
  -ms-transition: $transition; /* IE 9 */
  transition: $transition;
}

@mixin animation($animation){
  -moz-animation: $animation; /* FF3.6+ */
  -webkit-animation: $animation; /* Chrome, Safari */
  -o-animation: $animation; /* Opera */
  -ms-animation: $animation; /* IE 9 */
  animation: $animation;
}

@-webkit-keyframes show-a {
    0% {
      @include transform(scale(0.2));
    }
    50% {
      @include transform(scale(1.2));
    }
    100% {
      @include transform(scale(1));
    }
}

@-webkit-keyframes show-b {
    0% {
      @include transform(scale(0));
    }
    50% {
      @include transform(scale(0));
    }
    90% {
      @include transform(scale(1.2));
    }
    100% {
      @include transform(scale(1));
    }
}

body {
    padding: 40px;
    text-align: center;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    background: #fff;
}

label input[type="checkbox"] {
    display: none;
}

label input[type="checkbox"] + div {
    height: 50px;
    width: 60px;
    border: solid 1px #F0F4F5;
    background: #F0F4F5;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    margin: 10px;
    display: inline-block;
    text-align: center;
    line-height: 60px;
    color: #BEC7C7;
    @include transition(all 0.3s);
    
    i.fa {
        font-size: 1.6rem;
    }
                
    &:before {
        content: " ";
        display: block;
        opacity: 0;
        height: 26px;
        width: 26px;
        position: absolute;
        top: -15px;
        right: -15px;
        border-radius: 100%;
 ...