<!DOCTYPE html> <style> span { color: red; } #foo span { color: green } </style> <div> <span></span> </div> <div id="foo"> <span>This should be green</span> </div>