gpt4 book ai didi

css - Sass 和 Bourbon 的 IE 条件注释

转载 作者:行者123 更新时间:2023-12-04 21:41:25 36 4
gpt4 key购买 nike

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

有没有一种巧妙的方法可以用 Sass/Bourbon 做到这一点?

这是我到目前为止所拥有的:

<!--[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]-->

最佳答案

这个问题不在 sass 范围内,因为它只是一个预处理器,对浏览器一无所知。
也超出了 css 范围决定不同浏览器的条件。

您可以像 html5 样板一样向 html 添加一个 ie8 类,然后使用 css 规则激活字体。

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 文件中
<!--[if IE 8]>         <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->

关于css - Sass 和 Bourbon 的 IE 条件注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25435024/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com