css - How rotate an image by clicking button instead of :hover? -


so have image , instead of having rotate using:hover, place button side when clicked rotate image. example image of shirt on online store, there button rotates image can displayed.

depending on markup structure, possible purely css.

here's 1 such method using :checked property of checkbox run snippet see how works:

.checkme{      display:none;  }  .checkme + label{      cursor:pointer;      background:#efefef;      padding:4px 8px;      margin-bottom:5px;  }    .checkme + label > .back{      display:none;  }  .checkme:checked + label > .front{      display:none;  }  .checkme:checked + label > .back{      display:inline;  }    .checkme + label + .imgbox{      width:150px;      height:150px;      background-image:url("http://www.placehold.it/150x150");  }  .checkme:checked + label + .imgbox{      background-image:url("http://www.placehold.it/149x149");  }
<input id="foo" class="checkme" type="checkbox"/>  <label for="foo">      <span class="front">show back</span>      <span class="back">show front</span>  </label>  <div class="imgbox">


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -