blog_freebie_2Another beautiful feature feature any mobile website should have are OS Styled Checkboxes. In this case, we’re giving out a free example of the ones used in iOS, and with a bit of tinkering around you can adapt them to your needs. Nike Air Max 95 Homme The beauty of it? It’s pure CSS3 and HTML, so there’s no plugin, it’s just a copy and paste away!

The HTML

<div class="onoffswitch"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked> <label class="onoffswitch-label" for="myonoffswitch"></label> </div>

The code above will generate our CSS3 Switch.The first line houses the code, the second is the actual input. Asics Femme The third line is the “label” element, and this will be clicked. Nike Air Max Thea Femme Rose Please note that if you plan on using multiple switches on your page, you’ll have to replace the ID and the FOR values of your elements so they don’t accidentally open one another.

The CSS

.onoffswitch { position: relative; width: 60px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch-checkbox { display: none; } .onoffswitch-label { display: block; overflow: hidden; cursor: pointer; height: 36px; padding: 0; line-height: 36px; border: 2px solid #CCCCCC; border-radius: 36px; background-color: #FFFFFF; transition: background-color 0.3s ease-in; } .onoffswitch-label:before { content: ""; display: block; width: 36px; margin: 0px; background: #FFFFFF; position: absolute; top: 0; bottom: 0; right: 22px; border: 2px solid #CCCCCC; border-radius: 36px; transition: all 0.3s ease-in 0s; } .onoffswitch-checkbox:checked + .onoffswitch-label { background-color: #2ecc71; } .onoffswitch-checkbox:checked + .onoffswitch-label, .onoffswitch-checkbox:checked + .onoffswitch-label:before { border-color: #2ecc71; } .onoffswitch-checkbox:checked + .onoffswitch-label:before { right: 0px; }

The CSS behind the CSS switch is very easy as well. louboutin homme Let’s get to explaining the basics. New Balance 678 homme Resizing the switch is easy. asics gel stratus donna You’ll have to replace the values of line 2 for the width, line 10 and 11 for the height and line-height plus line 11 for the border radius. new balance pas cher Also line 17. New Balance 1400 femme To place the “tapper” correctly you’ll have to replace the value on line 20. Nike Air Max BW Femme This is most easily done by trial and error. To change the colors of the elements you simply need to edit lines 12, 25 and 28.