pin*_*mck 5 firefox google-chrome escaping less
我正在将css文件转换为更少的手动,我正在尝试找到一种方法来执行浏览器特定的CSS.我尝试使用网站上提到的〜""来逃避它,但它似乎不适用于整个代码块.
对于IE,这些工作:
padding: ~"5px\9"; /* IE8 and below */
*padding:4px; /* IE7 and below */
_padding:2px; /* IE6 */
Run Code Online (Sandbox Code Playgroud)
对于Chrome,这适用:
/* This will apply the styling only to Chrome and Safari */
@media screen and (-webkit-min-device-pixel-ratio:0) {
#mySelector {
color: red;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,Firefox呢?我如何逃避:
/* This will apply the styling only to Firefox */
@-moz-document url-prefix() {
#mySelector {
color: red;
}
}
Run Code Online (Sandbox Code Playgroud)
pin*_*mck -1
根据其他黑客的评论和可用性,我创建了一个解决方法。
如前所述,它确实使用 WinLess.org 编译器 (http://winless.org/online-less-compiler) 进行编译。
它不能使用 DotLess 进行编译,所以我刚刚逆转了黑客攻击。代替:
#mySelector {
color: red;
}
/* This will apply the styling only to Firefox */
@-moz-document url-prefix() {
#mySelector {
color: green;
}
}
Run Code Online (Sandbox Code Playgroud)
我改为这样做:
/* FF needs green*/
#mySelector {
color: green;
/*IEs need red*/
color: ~"red\9";
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
#mySelector {
/*Chrome needs red*/
color: red;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1582 次 |
| 最近记录: |