“Additive” property values with LESS mixin

前端 未结 1 1158
礼貌的吻别
礼貌的吻别 2021-01-25 06:57

I\'m looking for a feature that may or may not be available in LESS.

I have a mixin that adds a \"glow\" with box-shadow, which I use on various elements - buttons, inpu

相关标签:
1条回答
  • 2021-01-25 07:21

    The feature you're looking for is merge. You'd do this:

    .glow() {
        box-shadow+: 0 0 5px skyBlue;
    }
    .button {
        box-shadow+: inset 0 5px 10px black;
        .glow();
    }
    

    Note that both rulesets need to use the + syntax for it to work.

    Or, you could declare the glow rule as a variable:

    @glow: 0 0 5px skyBlue;
    
    .button {
        box-shadow: inset 0 5px 10px black, @glow;
    }
    
    0 讨论(0)
提交回复
热议问题