如何在LESS中使用这种风格的css?
我想使用一些 css 框架,但讨厌它的无语义性。所以我想用 LESS。基本思想是将框架的 css 混合到我自己的类中。但我觉得LESS无法处理某些场景。例如,一些类在框架中定义为:
div.prepand = {...} 或者 * html .span-1 = {...}
LESS mixin 似乎不支持上述情况。有什么想法吗?
I want to use some css framework but hate its unsemanticness. So I want to use LESS. The basic idea is mixin framework's css into my own classes. But I feel LESS can't handle some scenarios. For example, some classes are define in the framework as:
div.prepand = {...}
or
* html .span-1 = {...}
LESS mixin doesn't seem to support the above situations. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定您所说的“某些类在框架中定义为:”是指哪个框架。
在 Less 中,您不会按照显示的方式声明 mixin。你这样做:
然后在文件下面,你可以像这样(重新)使用它:
除此之外,我不明白你的问题。您想将框架的 CSS 混合到您自己的类中吗?这意味着什么?你用 Less 编写 CSS,否则你就不会......
I'm not sure which framework did you mean by saying that "some classes are define in the framework as:".
In Less, you don't declare mixins the way you showed it. You do it like so:
And then below in the file you can (re)use it like so:
Other than that, I don't understand your question. You want to mixin framework's CSS into your own classes? What does that mean? You write CSS in Less or you don't ...
我刚刚在 此处 中将 blueprint.css 的网格部分放在一起。您可以设置列和装订线宽度,然后使用这样的混合:
我还添加了几个示例 @media 查询,允许响应式布局。
我希望它对某人有用。
I've just put together the grid portion of blueprint.css in LESS here. You can set the column and gutter widths, then use mixins like this:
I've added a couple of example @media queries as well, allowing for responsive layouts.
I hope it might be of use to someone.