-1
I need to leave menu checkbox
as in the image but my background is in the father div and my checkbox
is a div son how can I apply that background in a div father cleaving into a div son
HTML:
<div class="bg-checkbox-dynamic -gray-light">
<div class="custom-controls-stacked d-block my-3">
<label class="custom-control custom-ctr material-checkbox">
Link 1
<input type="checkbox" class="material-control-input">
<span class="material-control-indicator"></span>
</label>
</div>
</div>
Css:
.bg-checkbox-dynamic{
background-color: $gray-dark;
padding: 1px 15px;
@include border-radius(15px);
}
input[type="checkbox"]:checked ~ .bg-checkbox-dynamic{
background-color:lime!important;
color:white
}
Only with Javascript you will be able to access a parent through the child. CSS does the opposite, selects child, sibling and adjacent elements.
– Sam
@Sam How would that look ?
– Felipe Henrique
You don’t need JS, da to do it with CSS, but not the way you’re thinking, da to do it with pseudo element, or simply put the checkbox before the parent, since it will be activated by clicking on the label, and not on the checkbox itself
– hugocsl
@hugocsl so I can’t put the checkbox before because it messes everything up because I’m styling it the idea is to leave in the structure I set up how the css would look then
– Felipe Henrique