Google Material Design Style Checkbox Transition Effect with CSS3

Category: CSS & CSS3 , Form , Recommended | July 5, 2014
Author:Sambego
Views Total:23,952 views
Official Page:Go to website
Last Update:July 5, 2014
License:Unknown

Preview:

Google Material Design Style Checkbox Transition Effect with CSS3

Description:

In this article we’re going to create animated checkboxes with fancy transition effects introduced in  Google Material Design, by using CSS3 transitions and transforms.

How to use it:

Insert an standard Html checkbox into your document.

<input type="checkbox" class="checkbox" checked>
<input type="checkbox" class="checkbox">

The CSS to style & animated the checkboxes.

.checkbox {
  position: relative;
  top: -0.375rem;
  margin: 0 1rem 0 0;
  cursor: pointer;
}
.checkbox:before {
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
  content: "";
  position: absolute;
  left: 0;
  z-index: 1;
  width: 1rem;
  height: 1rem;
  border: 2px solid #f2f2f2;
}
.checkbox:checked:before {
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
 height: .5rem;
  border-color: #009688;
  border-top-style: none;
  border-right-style: none;
}
.checkbox:after {
  content: "";
  position: absolute;
  top: -0.125rem;
  left: 0;
  width: 1.1rem;
  height: 1.1rem;
  background: #fff;
  cursor: pointer;
}

You Might Be Interested In:


2 thoughts on “Google Material Design Style Checkbox Transition Effect with CSS3

    1. Edinei Jacob Bauer

      checkbox don’t have “:before” or “:after”, just chrome accept this. So, to fix this, create a span after the input (in html document), and replace all css “:before” and “:after” for ” + span:before” and ” + span:after”.

      Reply

Leave a Reply