gpt4 book ai didi

css - 将 Google Web 字体与 SASS/Compass 结合使用——怎么样?

转载 作者:行者123 更新时间:2023-11-28 08:59:09 25 4
gpt4 key购买 nike

假设我有这个字体:Open Sans

如果我想在 SASS/Compass 元素中使用它,是否有更好的方法,然后链接到由 Google 托管的附加样式表以便能够使用该字体?

最佳答案

使用@import 选项:

@import url(http://fonts.googleapis.com/css?family=Open+Sans);

或者 JavaScript 选项:

<script type="text/javascript">
WebFontConfig = {
google: { families: [ 'Open+Sans::latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})(); </script>

关于css - 将 Google Web 字体与 SASS/Compass 结合使用——怎么样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17689100/

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