7

Easy points here for anyone who knows. I am looking for a detailed answer on what it (>) means and how it should be used. Thanks.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
bkbarton
  • 349
  • 1
  • 6
  • 17
  • are you looking for http://stackoverflow.com/questions/1628485/what-does-in-css-mean?rq=1 – N30 Jul 03 '12 at 14:31

3 Answers3

4

The < is not valid CSS, you should not use it anywhere in your CSS.

empiric
  • 7,825
  • 7
  • 37
  • 48
Huangism
  • 16,278
  • 7
  • 48
  • 74
4

There is no valid symbol as < in CSS. If you use it, you will invalidate your css.

However, you may want to use > - the child selector.

CSS4 will introduce a subject selector. At the moment it is marked with $.

so

$#parent a:hover{
   /* styles */
}

so these rules will not apply to the a in hoverstate, but it's parent with the parent-ID. CSS4 spec

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Christoph
  • 50,121
  • 21
  • 99
  • 128
1

You may be thinking of the > (great than symbol) selector.

This selector is known as the child combinator selector.

This means it will only select direct children of the parent. For example:

ul > li

So for example, if you wanted to style a nested unordered list as such:

<ul>
<li></li>
    <li>
       <ul>
       </ul>
    </li>
</ul>

You would have to style it as such:

ul > li > ul

But this is only in the case of using >, child combinator selector.

Christoph
  • 50,121
  • 21
  • 99
  • 128
Aaron Brewer
  • 3,567
  • 18
  • 48
  • 78
  • `ul ul` would also catch that particular case… we could add a `ul` inside the `li` to make it more relevant, though I'm not actually sure what putting a `ul` directly inside a `ul` would do. – Matchu Jul 03 '12 at 14:39
  • @Matchu: I never place a ul inside a li, if I am going to nest a ul, I make sure I put it within the ul, not the li. It have the exact same results, it just makes your HTML look cleaner and more readable. – Aaron Brewer Jul 03 '12 at 14:41
  • Sorry, but I don't see non-validating HTML as "cleaner" than validating HTML. – Mr Lister Jul 03 '12 at 14:43
  • @MrLister: Regardless of the validity of the HTML in my "example", my answer to the question above is correct and I do not see why you would be concentrating on the validity of nesting an unordered list instead of answering the users question. – Aaron Brewer Jul 03 '12 at 14:46
  • @AaronBrewer how you write it, it's creates invalid markup. Very dangerous since you can't rely on consistent rendering. – Christoph Jul 03 '12 at 14:47
  • @Christoph: There, I have validity in my unordered list now. – Aaron Brewer Jul 03 '12 at 14:48
  • now your selector does not match^^ – Christoph Jul 03 '12 at 14:49
  • @Christoph: Now it does. – Aaron Brewer Jul 03 '12 at 14:49
  • yep. offtopic: You dont like spelling names right? ;-D – Christoph Jul 03 '12 at 14:50