Possible Duplicate:
What does “>” mean in CSS rules?
CSS has the following two syntaxes which seem to be doing the same thing. Selecting a nested element.
div span
div > span
Am I missing something, or are these two indeed equivalent selectors ?
Possible Duplicate:
What does “>” mean in CSS rules?
CSS has the following two syntaxes which seem to be doing the same thing. Selecting a nested element.
div span
div > span
Am I missing something, or are these two indeed equivalent selectors ?
No, they are not equivalent. The first one is the descendant selector, while the second is the child selector.
Quick example:
<div class="a">
  <div class="b">
    <div class="c"></div>
  </div>
</div>
With this markup .a > .c will select nothing, while .a .c and .a > .b > .c will select the innermost element.
 
    
    div span
Will select any span that is inside any div. This could be multiple levels deep.
div > span
Will only select any spans that are the direct descendants of a div. More info about child selectors -> http://meyerweb.com/eric/articles/webrev/200006b.html
