What is ">ul" means in SASS?
Asked Answered
B

2

17

Here is the SASS code part:

#main-nav{
     >ul{
              blahblah
        }
}

So I want to know the exact mean of the string ">ul" means? I cannot find it in the SASS manual.

Furthermore, can it be translated to stylus?

Bunche answered 5/8, 2013 at 14:1 Comment(2)
w3.org/TR/css3-selectors/#child-combinatorsSuperconductivity
The grammatical way to ask this question is 'What does ">ul" mean in SASS?'State
I
27

This the CSS syntax to select the child of an element. See this reference for more on how it works:

This selector matches all elements that are the immediate children of a specified element. The combinator in a child selector is a greater-than sign (>). It may be surrounded by whitespace characters, but if it is, Internet Explorer 5 on Windows will incorrectly treat it as a descendant selector. So the best practice is to eschew whitespace around this combinator.

Irrepealable answered 5/8, 2013 at 14:5 Comment(1)
I think it's okay to ignore internet explorer 5 compatibility at this point.. Except maybe for highly specialized situationsQua
C
12
#main-nav {
    > ul {
        color: red;
    }
}

The same in CSS:

#main-nav > ul { color: red }

About > selector you can read here http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/ (#8)

Countrybred answered 5/8, 2013 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.