【发布时间】:2019-01-01 02:16:06
【问题描述】:
我有一个JS代码:
fontCode += "*{font-family: " + sendFont.f + ", fontAwesome !important;}";
我想通过css添加一些字体font-face
所以我将font-face 代码添加到一个名为font-face.css 的css 文件中
然后我尝试将font-face.css 文件包含到 JS 中,我将 js 代码更改为:
fontCode += "@import url('font-face.css'); *{font-family: " + sendFont.f + ", fontAwesome !important;}";
但它没有用!我不知道如何在我的 js 文件中使用 css font-face。
【问题讨论】:
-
stackoverflow.com/help/mcve 请提供更多代码。您提供的内容没有足够详细地描述问题,无法全面了解问题。我建议提供更多代码
-
您想在某些事件中使用 JS 动态更改 html 中的字体吗??
标签: javascript html css font-face