In the example below, I have a lot of tags where the tags contain inputs.
Is there a way to make the CSS opacity style apply to the label's innerText rather than any child elements without explicitly specifying the color? In the example below, opacity has been applied to the dropdown menu, not just the label itself.
I know I could change the label element to just surround the text and then add a for=
, but I prefer to wrap the label around the element being tagged.
div{ padding: 10px;} select { background-color: white; } .colored{ color: white; background-color: lightblue; } label { opacity: .7; }
Unfortunately,
opacity
applies to the container and everything in it. But in your case you can usergba
color
instead: