1
div li:first-child

what does above css selector target?

  1. First li's of every div on the page

or

  1. All the descendant li's of the div where div is the first child of its parent
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
alter
  • 4,320
  • 7
  • 31
  • 36

3 Answers3

5

The first-child applies to the li. It should select lis that are first children under any div.

meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
0

The first LI inside a DIV. Example.

Gert Grenander
  • 16,866
  • 6
  • 40
  • 43
  • +1 for a link to jsfiddle.net, I hadn't seen that site before but it looks extremely useful – acqu13sce Aug 08 '10 at 04:10
  • 1
    It's not just "the" first `li` in the `div`. It's any `li` that's the first child of its parent `ul` or `ol` in the `div`. If you add another `ul` into the `div`, you'll see that the first `li` in the second `ul` is also selected. – BoltClock Jan 25 '12 at 22:04
-1

1) First li's of every div on the page

unigg
  • 466
  • 3
  • 8