Radio to Switches

Easy way to do that

by Rohit Bisht

HTML

<div class="doc_format switch1">
    <input type="radio" class="switch-input1" name="format" value="pdf" id="pdf">
    <label for="pdf" class="switch-label1 switch-label-pdf">PDF</label>
    <input type="radio" class="switch-input1" name="format" value="xls" id="xls">
    <label for="xls" class="switch-label1 switch-label-xls">XLS</label>
    <input type="radio" class="switch-input1" name="format" value="xml" id="xml">
    <label for="xml" class="switch-label1 switch-label-xml">XML</label>
</div>

CSS

.switch1 {
    position: relative;
    height: 25px;
    width: 100%;
    background-color:white;
    border-radius: 5px;
}

.switch-label1 {
    position: relative;
    float: left;
    width: 60px;
    line-height: 26px;
    font-size: 11px;
    color: black;
    text-align: center;
    cursor: pointer;
}

.switch-label1:active {
    font-weight: bold;
}

.switch-label-pdf {
  width:33.33%;
}

.switch-label-xls {
  width:33.33%;
}

.switch-label-xml {
  width:33.33%;
}

.switch-input1 {
    display: none;
}

.switch-input1:checked+.switch-label1{
    font-weight: bold;
    color: white;
    background-color:red;
    text-shadow: 0 0px 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;
    border-radius: 5px;
}