lundi 7 mars 2016

how to create checkbox image base

I want to create some kind of checkboxes which is totally image base. This means that when I click that image then the border color change to some kind of color: lets say blue and stay blue until the next click which cancel it. The problem is that I don't know from where to start, I have create some kind of checkboxes base image with green mark, but I don't succeed to convert them to my desired request. This is the final result,which I need to get: final result

The images are hosted on tinypic in the following links: http://ift.tt/1StC2K3 http://ift.tt/21gyw6b

This is my code so far, which isn't on the right direction at all:

input[type="checkbox"]:not(old){
  width: 28px;
  margin: 0;
  padding: 0;
  opacity: 0;
}

input[type="checkbox"]:not(old)+label{
  display: inline-block;
  margin-left: -28px;
  padding-left: 28px;
  line-height: 24px;
  background: url(http://ift.tt/1StC30o) no-repeat 0 0;
}

input[type="checkbox"]:not(old):checked + label{
   background-position : 0 -24px;
}

<div class="checkbox">
  <input id="chk1" type="checkbox" name="animal" value="dog"/>
  <label id="lbl1" >Dog</label>
  <br>
  <input id="chk2" type="checkbox" name="animal" value="cat"/>
  <label id="lbl2" >Cat</label>
  <br>
  <input id="chk3" type="checkbox" name="animal" value="horse"/>
  <label id="lbl3" >Horse</label>
</div>




Aucun commentaire:

Enregistrer un commentaire