-5

Possible Duplicate:
What does “>” mean in CSS rules?

I have seen this in some CSS

body > .navid

What I want to know is, what does the ">" sign do in this CSS piece of code?

Community
  • 1
  • 1
Barry Steyn
  • 1,563
  • 3
  • 19
  • 25

3 Answers3

4

it's a selector for children (not just any descendent).

The selector body > .navid would select the .navid div using the following:

<body>
    <div class="navid"></div>
</body>

But it would not select the .navid div below because it's a grandchild

<body>
    <div>
        <div class="navid"></div>
    </div>
</body>
MikeM
  • 27,227
  • 4
  • 64
  • 80
1

It points to the direct child of an element so for example you can have

body > .something

it points to the class "something" within only the body element.

wzsun
  • 295
  • 2
  • 7
  • 15
0

It's called the Descendant selector, it selects

an F element child of an E element

Reference : http://www.w3.org/TR/css3-selectors/

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758