Unfortunately, what you are requesting is not feasible. CSS operates from left to right, making it impossible to target the parent element based on a child's attributes. While this can be accomplished with JavaScript, I understand your reluctance to use it.
Here is an illustration of HTML:
<div class="box">
<div class="green">
Some text
</div>
</div>
<div class="box">
<div class="red">
Some Text
</div>
</div>
An example of CSS is shown below:
.box {
color: blue;
}
.box .green {
color: green;
}
.box .red {
color: red;
}
It is evident that while you can style the parent element individually, targeting it based on a child's attributes is not possible.
Conventionally, it is recommended to work from the inside out. If you require specific styling for the parent element, consider adding an additional class.
Here is an example of HTML:
<div class="box green">
Some Text
</div>
The corresponding CSS is as follows:
.box.green {
color: green;
}
In the above CSS snippet, it is evident that classes can be layered to target the desired element.
I hope this clarifies things. If you have any queries, feel free to ask. Should you wish, I can provide a JavaScript alternative that allows targeting an element based on a child element's attributes if you create a new discussion thread for it.