how can I make a css style NOT affect children of that element
$<style type="text/css">
.parent {
background-color: #0F0;}
.child {
background-color:#fff
}
</style>
<div class="parent">parent<div class="child">child</div>Parent2</div>
(that DOES affect)
I know you can you the “<” to apply the style to only children of certain parents but how can the style ONLY be applied to one element?
By default,
background-coloristransparent. If I understand your question correctly, you are seeing the parent’s background through the child’s transparent one. The only way around this is to set the child’s background to be the colour you want it to.