Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Spring 2019

## Contextual Selectors

`selector1 selector2 { ...rules... }`

Example 3.35 - contextual selectors - Example 3.35 (Without Styles) | <div><em>Emphasized text</em> outside of <strong>li</strong> appear "normal". <ul><li><em>Emphasized text</em> within <strong>li</strong> have a different style. </li></ul></div> li em { color: red; background-color: navy;}

- Markup
- Style
- Screenshot

     <div><em>Emphasized text</em>outside of<strong>li</strong>appear "normal".<ul>
    <li><em>Emphasized text</em>within<strong>li</strong>have a different style.</li>
    </ul></div>

In `style` element (`<style type="text/css">`) within `head` element:

    li em { color: red; background-color: navy;}

Copyright © David Heitmeyer