Less CSS - class declaration in html?

不羁岁月 提交于 2019-12-13 04:39:52

问题


I get where less could be used, but doing 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?


回答1:


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.



来源:https://stackoverflow.com/questions/7423647/less-css-class-declaration-in-html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!