html - IE 11 上的字体支持

标签 html css fonts

我在 IE 11 上遇到字体问题。我的一些元素不能接受 font-family。我有 .woff.woff2 但它不接受我的字体。我该如何解决这个问题? 这是我的 CSS 代码:

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100;

  src: url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.eot'); /* IE9 Compat Modes */
  src: local('Roboto Thin'), local('Roboto-Thin'),
  url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.woff2') format('woff2'), /* Super Modern Browsers */
  url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.woff') format('woff'), /* Modern Browsers */
  url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.ttf') format('truetype'), /* Safari, Android, iOS */
  url('../../webfonts/roboto/roboto-v18-cyrillic-ext_latin-100.svg#Roboto') format('svg'); /* Legacy iOS */
}

我正在使用如下的 font-family 规则:

body {
  font-family: Roboto;
}

结果如下:

Failure

最佳答案

您的问题是您假设 Roboto 是内置网络字体,但事实并非如此。你需要引号:

body {
    font-family: 'Roboto';
}

关于html - IE 11 上的字体支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52268168/

相关文章:

javascript - 使用 javascript 更改 html id

html - 在调整页面大小之前,iframe 不会加载到 css 列中

jquery - 移动带有点击滑动效果的div?查询

html - 当页面宽度较低时,将两列(div)彼此对齐

CSS Div/Box 字体问题

html - 居中图像的div

html - 如何使用 CSS 创建响应式顶部栏

javascript - 如何使 input.error 在所有字段上工作?

fonts - Visual Studio 调色板窗口背景

ios - Xcode:自定义字体在 Xcode Storyboard 中显示错误的样式