开发者

Less CSS - class declaration in html?

开发者 https://www.devze.com 2023-04-05 03:30 出处:网络
I get where less could be used, but doin开发者_如何学运维g this (which doesn\'t work): <div class=\"fixed-width(150px)\" ></div>

I get where less could be used, but doin开发者_如何学运维g this (which doesn't work):

<div class="fixed-width(150px)" ></div>

.fixed-width(@customWidth) {
   width: @customWidth;
}

...seems like it makes more sense than the offered example of:

<div class="fixed-width" ></div>

.fixed-width {
   .another-step(150px);
}

.another-step(@customWidth) {
   width: @customWidth;
}

Is there an easy way to accomplish this I'm missing?


No. LESS compiles the CSS file only, not the inline CSS as well. You'd have to write an improved parser to generate the code you're already using.

0

精彩评论

暂无评论...
验证码 换一张
取 消