首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >附带Sass和Bourbon的IE条件注释

附带Sass和Bourbon的IE条件注释
EN

Stack Overflow用户
提问于 2014-08-21 20:06:46
回答 1查看 5.4K关注 0票数 5

我想为不同的浏览器提供不同的字体(参见this question)。

有没有一种巧妙的方法来解决Sass/Bourbon的问题?

到目前为止,我的情况如下:

代码语言:javascript
复制
<!--[if IE]> -->
@include font-face("myicons", "myicons", $weight: normal, $style: normal,
                   $asset-pipeline: false);
<![endif]-->
<!--[if !IE]> -->
@include font-face("myicons", "myicons", $weight: normal, $style: normal,
                   $asset-pipeline: true);
<![endif]-->
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-21 21:17:07

这个问题超出了sass的范围,因为它只是一个预处理器,对浏览器没有任何线索。也是css作用域之外,决定不同浏览器的条件。

您可以这样做,将ie8类添加到html中,就像html5样板所做的那样,然后使用css规则激活字体。

代码语言:javascript
复制
body {
  @include font-face("myicons", "myicons", $weight: normal, $style: normal, $asset-pipeline: false);

  .ie8 & {
    @include font-face("myicons", "myicons", $weight: normal, $style: normal, $asset-pipeline: true);
  }
}

在html文件中

代码语言:javascript
复制
<!--[if IE 8]>         <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html>         <!--<![endif]-->
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25435024

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档