Adjacent sibling selectors ,
Windows 7 Ultimate Key
Adjacent sibling selectors will select the sibling right away following a component.
For example, you might want to target an <h3> component,
Microsoft Office 2007 Professional, but only <h3> elements that instantly follow an <h2> factor. This is a commonly used illustration,
Windows 7 Download, as it has a real-world application. There is often too much space between <h2> and <h3> elements when they appear right away after each other. The code would be:
<body>
<h2>Heading 2 <em>text</em></h2>
<h3>Heading 3 text</h3>
<p>This is <em>text</em> and more <strong>text</strong></p>
</body>
The document tree would be:
Using the subsequent rule, you can goal any <h3> that follows an <h2>:
h2 + h3 margin: -1em;
Adjacent sibling selectors also work for inline elements such as <em> and <strong>
Using the following rule,
Office 2007 Key, you can goal <strong> text that follows <em> text:
em + strong color: blue;
Adjacent sibling selectors are not supported by Windows Internet Explorer 5,
Office Enterprise 2007, 5.5 and 6, but are supported by most other standards-compliant browsers.
Further information W3C CSS2 Specification: Adjacent sibling selectors DevEdge CSS2 Selectors Support Chart WestCiv Selectors Support Chart
Attribute selectors »
Other Max Design articles and presentations
Associated with webstandardsgroup.org