css for checkbox while hover -


i wanna change color each checkbox while hover.i have 4 checkbox.i wanna change color, if hover 'all' checkbox shows red,blue color 'cold',orange 'warm' , green 'active'.

#ck-button {    margin: 0px;    background-color: #efefef;    border-radius: 4px;    border: 1px solid #d0d0d0;    overflow: auto;    float: left;  }  #ck-button label {    float: left;    width: 4.0em;  }  #ck-button label span {    text-align: center;    padding: 3px 0px;    display: block;    border-radius: 4px;  }  #ck-button label input {    position: absolute;    top: -20px;  }  input:checked +span {    background-color: #911;    color: #fff;  }  #ck-button input:hover #all + span {    background-color: #efe0e0;  }  #ck-button input:hover #o1 + span {    background-color: blue;  }  #ck-button input:hover #o2 + span {    background-color: orange;  }  #ck-button input:hover #o3 + span {    background-color: green;  }
<div id="ck-button">    <label>      <input type="radio" name="sta_choice" id=all value="all" checked><span>all</span>    </label>  </div>  <div id="ck-button">    <label>      <input type="radio" name="sta_choice" id="o1" value="cold" onclick=handleclick1(this.val);><span class="o1">cold</span>    </label>  </div>  <div id="ck-button">    <label>      <input type="radio" name="sta_choice" id="o2" value="warm" onclick="handleclick1(this.val);"><span>warm</span>    </label>  </div>  <div id="ck-button">    <label>      <input type="radio" name="sta_choice" id="o3" value="active" onclick="handleclick1(this.val);"><span>active</span>    </label>  </div>

in last 4 lines use label:hover instead of input:hover. input positioned top , isn't hovered (is outside label).

#ck-button label:hover #all + span {     background-color:#efe0e0; } #ck-button label:hover #o1 + span {     background-color:blue; } #ck-button label:hover #o2 + span {     background-color:orange; } #ck-button label:hover #o3 + span {     background-color:green; } 

http://jsfiddle.net/3q4uuvum/3/


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -