LESSで変数に値を渡したいです。これどうやってするの?
ここにいくつかのサンプルコードがあります。.className()
値をvariableに渡したいと思います@varValue
。
@defaultWidth: 10px;
.className(@varValue: 1) {
width: (@defaultWidth * @varValue);
background: green;
}
.sample {
background: blue;
height: 10px;
.filled_1 { .className(1); }
.filled_2 { .className(2); }
.filled_3 { .className(3); }
}
HTML の例:
<div class="sample">
<div class="filled_3"></div>
</div>