Questions about nested direct descendants in LESS

So, I recently studied some code and am trying to learn more about LESS, and there is one thing that I cannot completely fool. I saw the use of something structured type:

.class{
    >*{
        /*some css*/
    }
}

NOTE. >*{}nested inside a block.class

I think there is an idea that this does, but there are a couple of things that I do not understand.

What I think this does: I assume that he takes all the direct descendants of this class and arranges them accordingly. so the actual (compiled) css may be something like.class > *{}

My questions:

  • Am I right in my assumption, or is it doing something completely different?

  • If this is correct, why is this operator not needed before it, like other concatenations?

, , , , Google .

+4
2

:

. . [1a]:

a {
   b {}
}

:

a b {}

, [1b]:

a {
   > b {}
}

:

a > b {}

.

---

& , , [2a]:

a {
    &:hover {}
}

a:hover {}

, , [2b]:

a { 
   b & {}
}

c { 
   & & {}
}

d {
  & {}
}

e { 
   f ~ g:not(&) > & & + &&& {}
}

// etc.

:

b a {}
c c {}
d {}
f ~ g:not(e) > e e + eee {}

---

-, , , :

a { > b {} } // ok
a > { b {} } // error
+3
  • .

  • & , > +, , ,

    .a { .b {} }
    

    .a .b.

+5

All Articles