>> English << | Português | По-русскиZVON > Tutorials > CSS tutorial
>> Example 6 << | Prev | Next | Contents

Description

If the selector list is not separated by commas, it has entirely different meaning, it specifies contextual selectors. It affects elements matching last mentioned selector if it is inside elements specified by preceding selectors.

Case 1 | Case 2 | >> Case 3 <<
HTML SourceCSS stylesheet

<dl>
<dt>A list:</dt>
<dd>
     <ul>
          <li>item 1</li>
          <li>item 2</li>
     </ul>
</dd>
</dl>
<div> And another one:
<ol>
     <li>ordered item 1</li>
     <li>ordered item 2</li>
     <li>ordered item 3</li>
</ol>
</div>
body {background-color: white; 
      color: black}


dl dd ul li, div ol li {background-color: red; 
                    color: blue}

Browser output