在Less(for< IE9)中写入浏览器特定的黑客攻击 [英] Writing browser specific hack in Less (for <IE9)
问题描述
我想这样做(来源 - CSS技巧文章
I want to do something like this (Source - CSS Tricks Article):
#veinte { color/*\**/: blue\9; }
在IE7和IE8中,但它提供错误。
in Less for IE7 and IE8 but it gives errors.
以下工作原理:
#diecinueve { color: blue\9; }
但有一些元素,我不想在IE9中调用。例如我有一些在IE9与:之前
元素,但因为IE8不支持它,我想给它一个 padding
but there are some elements that I dont want to be called in IE9. e.g. I have something in IE9 with :before
elements but because IE8 doesnt support it, I want to give it a padding
only in IE8.
但
#veinte { color/*\**/: blue\9; }
在Less中提供错误。我试过这个
gives errors in Less. I tried this
#veinte { color~"/*\**/": blue\9; }
但这也不行。有没有人知道如何在Less中这样做?
but that also doesnt work. Does anyone know how to do this in Less?
推荐答案
属性名称插值 。因此,这个黑客可以如下所示实现:
Property name interpolation is possible with Less v1.6.0 and above. Hence this hack can be implemented as shown below:
@hack: ~"/*\**/";
#veinte {
color@{hack}: blue\9;
}
编译的CSS:
$ b
Compiled CSS:
#veinte {
color/*\**/: blue\9;
}
这篇关于在Less(for< IE9)中写入浏览器特定的黑客攻击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!