1. 程式人生 > >Less學習筆記8:@arguments 變數

Less學習筆記8:@arguments 變數

@arguments 變數

[email protected]包含了所以傳遞進來的引數


如果不想單獨處理每一個引數的話就可以像這樣寫:
這之前的寫法:

.border_arg(@w:30px,@c:red,@xx:solid){
    border-width:@w;
    border-color:@c;
    border-style:@xx;
}

如果這這三個都不想寫,同時使用這個引數:

.border_arg(@w:30px,@c:red,@xx:solid){
    border:@arguments;
}

.test_arguments{
    .border_arg();
}

此時編譯後的CSS為:

.test_arguments{
    border:30px red solid;
}

更改其中一個引數:

.test_arguments{
    .border_arg(40px);
}

此時編譯後的CSS為:

.test_arguments{
    border:40px red solid;
}

這樣就能省那麼一點點的事