lundi 27 septembre 2021

CSS check box problem should select when Ill checked it

I created a check box into a div and I created a label.I want that when Ill click to check box(#check_box) that time it (#pop_hidden)will be hidden{display: none}. no problem if I use javascript. I just need a solution

#check_box[type=checkbox]:checked : #pop_hidden {
  display: none;
}
<div>
  <input type="checkbox" id="check_box">
</div>
<div>
  <label id="pop_hidden">CSS is Awesome</label>
</div>
Its Working if I use
<!DOCTYPE html>
<html>
<head>
<style> 
#checkbox[type=checkbox]:checked + #pop_hidden {
    display:none;
} 
</style>
</head>
<body>

<input type="checkbox" id="checkbox" name="ossm"> 
<label id="pop_hidden">CSS is Awesome</label>



</body>
</html>

but I want to use it into the div like the first example




Aucun commentaire:

Enregistrer un commentaire