mercredi 6 mai 2020

div in label will not check off checkbox

Is it possible with this HTML to have the DIV tag not check off the input checkbox tag when the DIV tag is clicked on? Is there any CSS that I can add to make this possible?

<style>
#myId ~ label {
    position: fixed;
     overflow: auto;

     top: 0;
     left: 0;

    height: 100%;
     width: 100%;



    background-color: red;
}

#myId ~ label div {
    width: 100%;

    background-color: yellow;

    height: 25%;
}

#myId:checked ~ label {
    display: none;
}
</style> 

<input id="myId" type="checkbox" />
<label for="myId">
    <div>Hello</div>
</label>



Aucun commentaire:

Enregistrer un commentaire