less 中function


  /**
   * .margin(@space, @limit-groups)
   */
  .margin(@space, @index: 10) when (@index > 0 ) {
    @value: @space * @index;
    @valuepx: @value * 1px;

    .ml-@{value} {
      margin-left: @valuepx;
    }

    .mr-@{value} {
      margin-right: @valuepx;
    }

    .mt-@{value} {
      margin-top: @valuepx;
    }

    .mb-@{value} {
      margin-bottom: @valuepx;
    }

    @next: @index - 1;

    .margin(@space, @next);
  }

  .margin(5);
    原文作者:jia
    原文地址: https://segmentfault.com/a/1190000007288708
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞