html - CSS @font-face 无法正常工作(第 2 期)

标签 html css fonts font-face webfonts

当我在我的电脑上使用 Firefox 或 IE 时,字体不起作用,只有在使用 Chrome 时才会出现。另外,当我使用我的手机时,即使有 chrome,字体也不起作用。

在 Gerardo BLANCO 的大力帮助下,请考虑下面我的代码。

@font-face {
  font-family: Signika;
  src: url('cllean-directory/fonts/Signika-Regular.ttf') format('truetype'), url('cllean-directory/fonts/Signika-Regular.woff') format('woff'), url('cllean-directory/fonts/Signika-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: Signika;
  src: url('cllean-directory/fonts/Signika-Bold.ttf') format('truetype'), url('cllean-directory/fonts/Signika-Bold.woff') format('woff'), url('cllean-directory/fonts/Signika-Bold.woff2') format('woff2');
  font-weight: bolder;
  font-style: normal;
}

@font-face {
  font-family: Signika;
  src: url('cllean-directory/fonts/Signika-Light.ttf') format('truetype'), url('cllean-directory/fonts/Signika-Light.woff') format('woff'), url('cllean-directory/fonts/Signika-Light.woff2') format('woff2');
  font-weight: lighter;
  font-style: normal;
}

@font-face {
  font-family: Signika;
  src: url('cllean-directory/fonts/Signika-Semibold.ttf') format('truetype'), url('cllean-directory/fonts/Signika-Semibold.woff') format('woff'), url('cllean-directory/fonts/Signika-Semibold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
}
  font-family: SignikaS;
}

最佳答案

你的错误很少。 1) 最好将所有字体系列命名为一个。 2)您需要声明其各自的重量和样式。 3)个人->永远把家庭放在第一位

希望对你有帮助

@font-face {
  font-family: Signika;
  src: url('fonts/Signika-Regular.ttf') format('truetype'), url('fonts/Signika-Regular.woff') format('woff'), url('fonts/Signika-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: Signika;
  src: url('fonts/Signika-Bold.ttf') format('truetype'), url('fonts/Signika-Bold.woff') format('woff'), url('fonts/Signika-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
}

p {
  font-family: Signika;
}
<p>Hi</p>
<p style="font-weight:bold">Hi</p>

关于html - CSS @font-face 无法正常工作(第 2 期),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48667819/

相关文章:

c++ - OpenGL 文本渲染方法和权衡

javascript - 如何通过 radio 和 Javascript 在 HTML 中使用更改位置

jquery - 使用 HTML、CSS 或 jQuery 绘制一个圆(带扇形)

html - 源代码顺序对可访问性有什么影响?来源顺序重要吗?

html - Bootstrap nav 交互式标签列表左右

html - <form> <asp> 或外部的标题

html - 将多种ttf字体添加到HTML2PDF并通过css在它们之间切换

java - GwtQuery droppable 编译 GWT 2.6.1 错误

html - 以 li 为中心对齐 div

android - 在 android webview 中显示 Malayalam Unicode 字体