You can give these elements a class:
#test > .red {
background-color: red;
}
#test > .blue {
background-color: blue;
}
<div id="test">
<div class="red">red bg</div>
<div class="blue">blue bg</div>
</div>
But note that the child selector is not supported in IE6 .
Update: If you still want to support IE6, and these are only two elements that you want to apply styles to, you can simply omit >(and possibly give them the class identifier).
source
share