Case

Test content should be on blue background.
Test content inside a child element should be on green background.
Nothing should be on red background.

CSS

div {width:250px;padding:10px 0;margin:10px 0;color:#fff;font-family:Arial;}

#elmid {height:250px;}
#elmid div {color:#ccc;}

/* if we add this to the mix... */
#elmid.otherelmclass {background:yellow;}

.elmclass {background:red;}
#elmid.elmclass {background:blue;}
#elmid.elmclass div {background:green;height:100px;}

HTML

<div id="elmid" class="elmclass">
	Test content should be on blue background.
	<div>
		Test content inside a child element should be on green background.
	</div>
	Nothing should be on red background.
</div>