Does LESS have an “extend” feature?

后端 未结 2 875

SASS has a feature called @extend which allows a selector to inherit the properties of another selector, but without copying the properties (like mixins).

2条回答
  •  北海茫月
    2020-11-29 21:52

    Easy way to extend a function in Less framework

    .sibling-1 {
        color: red
    }
    .sibling-2 {
        background-color: #fff;
        .sibling-1();
    }
    

    Output

    .sibling-1 {
      color: red
    }
    .sibling-2 {
      background-color: #fff;
      color: red
    }
    

    Refer https://codepen.io/sprushika/pen/MVZoGB/

提交回复
热议问题