更少的CSS - html中的类声明? [英] Less CSS - class declaration in html?

查看:84
本文介绍了更少的CSS - html中的类声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪里可以使用更少,但这样做(这不工作):

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;
}

...似乎比提供的示例更有意义: / p>

...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?

推荐答案

否。 LESS只编译CSS文件,而不编译内联CSS。你必须编写一个改进的解析器来生成你已经使用的代码。

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.

这篇关于更少的CSS - html中的类声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆