CSS assign class to child elements that are not a specific type

Suppose I have a DIV element whose id is mydiv.

<div id="mydiv">
   <div></div>
   <span></span>
   <p></p>
</div>

I want to assign a CSS class to only those direct descendants of this div that are not span elements. So in the above example the class should be assigned only to the child div and p elements. How do I accomplish this using CSS (not Javascript)?


Source: css

Leave a Reply