Contextual Selectors
These are strings of two or more simple selectors that let rules apply in certain circumstances. For example, if text that is to be emphasises within a paragraph wants certain decoration but emphasis text within, say, a heading doesn't. Consider the following:
Rule | Presentation |
---|---|
p em {background:red; color:white; font-style:italic} | |
Heading with emphasised text |
Heading with emphasised text |
Paragraph with emphasised text |
Text with emphasised text |
Note: the decoration on the emphasised text only when associated with a paragraph tag and not any other tags.