如果有兩個(gè)參數(shù),則它們將包含逗號(hào)分隔的列表。 例如 .class1(1, 2, 3; sometext, other thing).
如果有三個(gè)參數(shù),僅包括數(shù)字,如 .class1(1, 2, 3).
可以使用虛擬分號(hào)包含逗號(hào)分隔的列表 .class1(1, 2, 3;).
有逗號(hào)分隔的默認(rèn)值。 例如 .class1(@color: gray, green;)
.mixin_name(@var_name1; @var_name2:some){
//code here
}
<!doctype html> <head> <title>Mixin Multiple Parameters</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <h2>Example of Mixin Multiple Parameters</h2> <p class="myclass">LESS enables customizable, manageable and reusable style sheet for web site.</p> </body> </html>
.mixin(@color) {
color: @color;
}
.mixin(@color; @padding: 2) {
color: @color;
padding: @padding;
}
.myclass {
.mixin(#FE9A2E);
}
lessc style.less style.css
.myclass {
color: #FE9A2E;
padding: 2;
}