div {width:250px;padding:10px 0;margin:10px 0;color:#fff;font-family:Arial;}
#elmid {height:250px;}
#elmid div {color:#ccc;}
.elmclass {background:red;}
#elmid.elmclass {background:blue;}
#elmid.elmclass div {background:green;height:100px;}
<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>