Html 自定义字体龙虾在IE中不起作用
我想使用自定义字体lobster。我已下载了Html 自定义字体龙虾在IE中不起作用,html,css,fonts,Html,Css,Fonts,我想使用自定义字体lobster。我已下载了lobster.woff2文件并将其放置在字体文件夹中。 在我的自定义css中,我添加了 @font-face { font-family: 'Lobster'; font-style: normal; font-weight: 400; src: local('Lobster'), local('Lobster-Regular'), url(./fonts/lobster.woff2) format('woff2'); un
lobster.woff2
文件并将其放置在字体文件夹中。
在我的自定义css中,我添加了
@font-face {
font-family: 'Lobster';
font-style: normal;
font-weight: 400;
src: local('Lobster'), local('Lobster-Regular'),
url(./fonts/lobster.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
.wishes,{
color: #ff6315;
font-size: 24px;
font-weight: bold;
font-family: 'Lobster', cursive !important;
}
这在chrome和firefox中有效,但在IE中无效。请改用谷歌字体API。。。它会解决你的IE问题
- 谷歌浏览器:版本4.249.4+
- Mozilla Firefox:版本:3.5+
- Apple Safari:3.1版+
- Opera:10.5版+
- Microsoft Internet Explorer:第6版+
您的代码应该是:
@import url('https://fonts.googleapis.com/css?family=Lobster');
.wishes {
font-family: 'Lobster', cursive;
}
另一种方法是在html的头部添加指向google字体的链接,然后像往常一样在样式表中调用它。此代码来自,您可以将此代码段粘贴到html的头部:
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
你有url吗?你在测试什么版本的IE?重要信息,以便我们可以帮助您解决问题。Woff2格式仅在Edge中可用,之前没有支持它的IE,因此,您需要提供其他版本-我建议将其添加到您的html中,而不是@导入到您的样式表中。我正在使用IE12。在localhost中进行测试,因此没有url。我建议使用标题html url将字体加载到您的页面中,而不是@导入。您能给出一个示例吗?我将添加它作为答案。为什么不使用html标题改为链接到字体?
font-family: 'Lobster', cursive;