小编pin*_*mck的帖子

使用针对Firefox的lesscss和浏览器黑客

我正在将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)

firefox google-chrome escaping less

5
推荐指数
1
解决办法
1582
查看次数

标签 统计

escaping ×1

firefox ×1

google-chrome ×1

less ×1