Although the class and id attributes provide a great deal of flexibility for creating style rules, many other types of rules of equal value exist. For example, it might be useful to specify that all strong tags that occur within a p tag get treated in a certain way, as compared to the same elements occurring elsewhere within the document. To create such a rule, you must
use contextual selection. Contextual selectors are created by showing the order in which the tags must be nested for the rule to be applied. The nesting order is indicated by a space between each selector. , given the rule.all occurrences of the strong element within a p element have a maroon background. Other occurrences of strong without a p ancestor element might not necessarily have the yellow background.Contextual selection does not require a direct parent-child relationship with elements. the nested strong tag will still have a yellow background even though it is not directly
within the p tag. What you are seeing here is that the rule really says that all strong .tags that are “descendents” of a p tag are given a maroon background: For example, with the rule in the preceding example, you would find that given