1
// Mixin
.text-overflow() {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
當我們在代碼中使用這個mixin時,我們是否需要放置括號()?在LESS mixins中使用括號()
a.overflow {
.text-overflow();
display: block;
}
當調用混入,括號是可選的。在編寫mixin時,如果不想將mixin代碼作爲單獨的類輸出,可以使用大括號。 [來源](http://lesscss.org/features/#mixins-feature-not-outputting-the-mixin)。 – Harry 2014-08-28 12:20:37