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

Chapter 15. SELECTORS, PSEUDO-ELEMENTS A... > Adjacent Sibling Selectors

Adjacent Sibling Selectors

Adjacent sibling selectors allow Web authors to decide how one Web element should appear if it appears immediately after another specified element that shares the same parent. In such a case, you could define how different header tags should interact with each other (because their immediate parent is the body tag), but not, say, a header and a cell in a table, which fall under different parent elements (the header to the body tag; the cell to the table tag).

Adjacent sibling selectors use the plus symbol "+" between two or more elements, and specify that if a certain condition occurs between these two elements, formatting should occur according to the rule stated by the selector. In the following case, whenever a second-level header immediately follows a top-level header, the second-level header will be indented by 1 inch:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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