Generate pure CSS3 On/Off flip switches with animated transitions.
HTML
<div class="form-group">
<label>HEMANT VISHWAKARMA</label>
<div class="onoffswitch">
<input type="checkbox" name="pets_allowed" class="onoffswitch-checkbox" id="pets_allowed" value="pets_allowed">
<label class="onoffswitch-label" for="pets_allowed">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
CSS
<style>
.onoffswitch {
position: relative;
width: 65px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block;
overflow: hidden;
cursor: pointer;
border: 0px solid #999999;
border-radius: 20px;
height: 25px;
}
.onoffswitch-inner {
display: block;
width: 200%;
margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before,
.onoffswitch-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: 300;
box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "yes";
padding-left: 10px;
background-color: #41a541;
color: #FFFFFF;
margin-top: -3px;
}
.onoffswitch-inner:after {
content: "no";
padding-right: 10px;
background-color: #999;
color: #fff;
text-align: right;
margin-top: -3px;
}
.onoffswitch-switch {
display: block;
width: 20px;
margin: 2px;
background: #FFFFFF;
position: absolute;
top: 0;
bottom: 0;
right: 40px;
border: 0px solid #999999;
border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch {
right: 0px;
}
.box-body .box-title {
padding-top: 20px;
}
</style>
Switch CSS Tabs (On / Off) With Checkbox's
No comments:
Post a Comment