css3 - How can I rotate different cards using CSS? -
what trying have lot of cards displayed on screen. when click them, should rotate , change color. problem have no matter card click, first 1 changes, instead of 1 being clicked.
here fiddle:
html:
<body> <div class="pane"> <input type="checkbox" id="button"> <label class="card" for="button"></label> <input type="checkbox" id="button"> <label class="card" for="button"></label> <input type="checkbox" id="button"> <label class="card" for="button"></label> <input type="checkbox" id="button"> <label class="card" for="button"></label> </div> </body>
css:
input { width:100px; height:100px; display:none } .card { width:100px; height:100px; background:red; display:block; transition: background 1s, -webkit-transform 1s; } input:checked +.card { background:blue; -webkit-transform: rotatex(180deg); }
thanks
your problem you're using same id on 3 inputs , labels. per w3c spec, ids must unique on page. , that's for
attribute expecting. change code this: http://jsfiddle.net/gyatesiii/gz8zr/4/
Comments
Post a Comment