mardi 21 mars 2023

I want to make "onclick" effect on mobile with checkbox:checked (without using JS)

I want my dropup content to appear when I check my checkbox, but it isn't working. Dropup-content by default has visibility: collapse, so I want it to have visibility: visible when I check the checkbox. how it should look

I tried to put .dropup-content under input:checked + span but nothing change

index.html:

<label for="sports">  
  <input type="checkbox" id="sports" class="checkbox">  
  <span class="span-label">Sports</span>  
</label>  
<div class="dropup-content">  
  <a href="">More...</a>  
  <a href="">Esports</a>  
  <a href="">Handball</a>  
  <a href="">Basketball</a>  
  <a href="">Football</a>  
</div>

index.scss:

input:checked + span {
    color: orange;  //changes color of text Sports
   .dropup-content {
       visibility: visible;
       max-height: 250px; 
       transition: max-height 0.2s; 
  } 
}



Aucun commentaire:

Enregistrer un commentaire