使用带有LESS mixins的方括号()

时间:2014-08-28 12:14:29

标签: css less

// Mixin
.text-overflow() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

我们在代码中使用这个mixin时是否需要放置那些括号()?

a.overflow {
  .text-overflow();
  display: block;
}

1 个答案:

答案 0 :(得分:0)

在所有课程中,所有课程都被视为mixins。有和没有括号的区别在于不输出任何CSS。

示例

// Less file
.no-output(){
    color: red;
} 

.output {
    color: blue;
}

// Outputs
.output {
    color: blue;
}