Visit Mozilla.org

CSS::first-child

From MDC

« CSS Reference

[edit] Summary

The :first-child pseudo-class matches any element that is the first child element of its parent.

[edit] Syntax

element:first-child { style properties }


[edit] Examples

span:first-child
{
    background-color: lime;
}

...where...

  <div>
    <span>This span is limed!</span>
    <span>This span is not. :(</span>
  </div>

... should look like ...
This span is limed! This span is not. :(

[edit] Notes