Encountering an issue with modifying labels associated with a specific input. While changing a subsequent div upon checking the appropriate input (checkbox) works seamlessly, attempting the same approach for labels yields failure results. Even wrapping a label in an additional div and trying to target that instead of the label itself does not produce any desired outcome.
The main question here is: What am I missing or doing wrong in this scenario?
HTML
<input type="radio" id="TabOne" class="sheet-TabOne" name="Tab" checked="checked" />
<input type="radio" id="TabTwo" class="sheet-TabTwo" name="Tab" />
<div class="sheet-TabHeader">
<label for="TabOne" class="sheet-TabOne">One</label>
<label for="TabTwo" class="sheet-TabTwo">Two</label>
</div>
<div class="sheet-TabContent sheet-TabOne">
First content
</div>
<div class="sheet-TabContent sheet-TabTwo">
Second content
</div>
CSS:
label.sheet-TabHeader {
float: left;
width: auto;
border: 2px solid #A52A2A;
width: 150px;
height: 20px;
font-size: 18px;
background: #fff;
color: black;
}
input.sheet-TabOne:checked ~ label.sheet-TabOne,
input.sheet-TabTwo:checked ~ label.sheet-TabTwo
{
background: black;
color: red
text-shadow: 0px 0px 5px black,0px 0px 5px black,0px 0px 5px black;
}
div.sheet-TabContent {
display: none;
clear: left;
}
input.sheet-TabOne,
input.sheet-TabTwo
{
display: none;
}
input.sheet-TabOne:checked ~ div.sheet-TabOne,
input.sheet-TabTwo:checked ~ div.sheet-TabTwo
{
display: block;
}