LESSCSS - use calculation and return value

后端 未结 5 1965
北荒
北荒 2020-12-30 12:15

H i,

Hoping you can help.

Is there a way for LESS to return just a value - feel like I\'m missing something very obvious

Sa

5条回答
  •  北海茫月
    2020-12-30 13:13

    one of the simplest work around would be to pass the property and the value.

    mixin.less

    .lighter(@property, @color) {
      @{property}: multiply(white, fade(@color, 10%));
    }
    

    use.less

    .my-class{
      .lighter(background-color, #FF0000);
    }
    

    Results:

    .my-class{
      background-color: #fbe8eb;
    }
    

提交回复
热议问题