Working Demo
CSS Code
.container {
width: 70px;
}
.switch {
font-family: 'Lato Semibold';
position: relative;
margin: 0px auto;
height: 34px;
width: 70px;
background:#fff;
border-radius: 24px;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
}
.switch-label {
position: relative;
z-index: 2;
float: left;
width: 30px;
line-height: 26px;
font-size: 20px;
color: rgba(255, 255, 255, 0.35);
text-align: center;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
cursor: pointer;
color:#82d2ef;
padding-top:4px;
}
.switch-label:active {
font-weight: bold;
}
.switch-label-off {
padding-left: 2px;
}
.switch-label-on {
padding-right: 2px;
}
.switch-input {
display: none;
}
.switch-input:checked + .switch-label {
font-weight: bold;
text-shadow: 0 1px rgba(255, 255, 255, 0.25);
-webkit-transition: 0.15s ease-out;
-moz-transition: 0.15s ease-out;
-o-transition: 0.15s ease-out;
transition: 0.15s ease-out;
font-size: 20px;
color:#fff;
padding-top:4px;
}
.switch-input:checked + .switch-label-on ~ .switch-selection {
/* Note: left: 50% doesn't transition in WebKit */
left: 37px;
}
.switch-selection {
display: block;
position: absolute;
z-index: 1;
top: 1px;
left: 1px;
width: 32px;
height: 32px;
background: #2b4e72;
border-radius: 50px;
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
-webkit-transition: left 0.15s ease-out;
-moz-transition: left 0.15s ease-out;
-o-transition: left 0.15s ease-out;
transition: left 0.15s ease-out;
}
HTML CODE
<div class="container">
<div class="switch">
<input type="radio" class="switch-input" name="view" value="week" id="week" checked>
<label for="week" class="switch-label switch-label-off">F</label>
<input type="radio" class="switch-input" name="view" value="month" id="month">
<label for="month" class="switch-label switch-label-on" style="left:6px;">C</label>
<span class="switch-selection"></span>
</div>
CSS Code
.container {
width: 70px;
}
.switch {
font-family: 'Lato Semibold';
position: relative;
margin: 0px auto;
height: 34px;
width: 70px;
background:#fff;
border-radius: 24px;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
}
.switch-label {
position: relative;
z-index: 2;
float: left;
width: 30px;
line-height: 26px;
font-size: 20px;
color: rgba(255, 255, 255, 0.35);
text-align: center;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
cursor: pointer;
color:#82d2ef;
padding-top:4px;
}
.switch-label:active {
font-weight: bold;
}
.switch-label-off {
padding-left: 2px;
}
.switch-label-on {
padding-right: 2px;
}
.switch-input {
display: none;
}
.switch-input:checked + .switch-label {
font-weight: bold;
text-shadow: 0 1px rgba(255, 255, 255, 0.25);
-webkit-transition: 0.15s ease-out;
-moz-transition: 0.15s ease-out;
-o-transition: 0.15s ease-out;
transition: 0.15s ease-out;
font-size: 20px;
color:#fff;
padding-top:4px;
}
.switch-input:checked + .switch-label-on ~ .switch-selection {
/* Note: left: 50% doesn't transition in WebKit */
left: 37px;
}
.switch-selection {
display: block;
position: absolute;
z-index: 1;
top: 1px;
left: 1px;
width: 32px;
height: 32px;
background: #2b4e72;
border-radius: 50px;
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
-webkit-transition: left 0.15s ease-out;
-moz-transition: left 0.15s ease-out;
-o-transition: left 0.15s ease-out;
transition: left 0.15s ease-out;
}
HTML CODE
<div class="container">
<div class="switch">
<input type="radio" class="switch-input" name="view" value="week" id="week" checked>
<label for="week" class="switch-label switch-label-off">F</label>
<input type="radio" class="switch-input" name="view" value="month" id="month">
<label for="month" class="switch-label switch-label-on" style="left:6px;">C</label>
<span class="switch-selection"></span>
</div>