• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter Nine. CSS Basics > Contextual (Descendant) Selectors

Contextual (Descendant) Selectors

You can avoid classitis and keep your markup neat and clean by making the style of an element dependent upon the context in which it appears. Selectors that apply rules in this way are called contextual selectors in CSS1 because they rely on context to apply a rule or refrain from doing so. CSS2 calls them descendant selectors, but their effect is the same no matter what you call them.

To italicize text that's marked <strong> and prevent it from displaying in boldface when it occurs within a list item, you would type:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint