LESSCSS - use calculation and return value

后端 未结 5 2014
北荒
北荒 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 12:50

    // mixin
    .parseInt(@string) {
        @parseInt: unit(@string, );
    }
    

    Usage:

    .selector {
        .parseInt(100px);
        width: @parseInt + 10; // px will automatically be appended
    }
    

    Result:

    .selector {
        width: 110px;
    }
    

提交回复
热议问题