Is there a way to have the CSS transparency style apply only to the label's innerText and not to any child elements?
P粉794851975
P粉794851975 2023-08-17 20:51:57
0
1
463

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; }
 


P粉794851975
P粉794851975

reply all (1)
P粉066224086

Unfortunately,opacityapplies to the container and everything in it. But in your case you can usergbacolorinstead:

select { background-color: white; } .colored{ color: white; background-color: lightblue; padding: 10px; } label { color: rgba(255, 255, 255, .7); }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!