LESS: Extend a previously defined nested selector

前端 未结 4 881
臣服心动
臣服心动 2020-12-20 19:27

I\'ve been trying like a mad man to get the following LESS statement to work, but now i am fearing that it\'s not gonna happen :/ So I am turning now to you guys in the end

4条回答
  •  忘掉有多难
    2020-12-20 19:49

    LESS currently does not support extending a "concatenated name" selectors (basically, .top &-first &-item is interpreted as three distinct selector elements and never found by extend looking for a single selector).

    A workaround for your particular case:

    .top {
        &-first {
            background: black;
        }
    
        &-second {
            background: green;
        }
    
        &-first, &-second {
            &-item {
                color: white;
            }
        }
    }
    

提交回复
热议问题