html - Can I select css parent element? -
this question has answer here:
- is there css parent selector? 25 answers
i'm trying create product selection css using checkbox. codes here
.vfb-checkbox{ width:180px; height:130px; background:url('http://i304.photobucket.com/albums/nn181/amam_dewan/2932337756_1845773ed4_q_d_zpsea5idhnt.jpg'); } /* checkboxes */ .vfb-checkbox label { cursor: pointer; display: block; position: relative; width:100%; height:100%; } .vfb-checkbox label:before { content: ""; height:100%; width:100%; position: absolute; left: 0; } .vfb-checkbox label:hover{ background:rgba(0,0,0,.7) url(http://i304.photobucket.com/albums/nn181/amam_dewan/selected_zpsvfoaira0.png)center center no-repeat; } .vfb-checkbox input[type=checkbox] { display: none; } input[type=checkbox]:checked + label:before { background: rgba(0,0,0,.4) url('http://i304.photobucket.com/albums/nn181/amam_dewan/selected_zpsvfoaira0.png') center center no-repeat; }
<div class="vfb-checkbox"> <label for="check1"> <input id="check1" type="checkbox" name="check" value="check1"> </label> </div>
when click on image should checked not working. when set label tag followed input tag it's working, want exact same html structure.
there no parent selector in css.
Comments
Post a Comment