html - CSS @font-face 不呈现

标签 html css font-face

我在我的网站的样式表中使用了以下代码,但是当我在浏览器中运行它时它不会呈现,字体也不会呈现。我做错了什么?

@font-face {  
  font-family: 'Libel Suit';  
  src: url('my.ip.n.n/~/wordpress/fonts/libelsuit.woff') format('woff'),  
       url('my.ip.n.n/~/wordpress/fonts/libelsuit.ttf') format('truetype');  
       // These aren't the exact URLS I'm using, since I don't want the  
       // world to know my ip address
}

最佳答案

检查您的 network panel确定是否实际加载了字体:

enter image description here

如果是,请确保您在 CSS 中正确引用了它们,例如:

h1 {
  font-family: 'Libel Suit'; 
}

关于html - CSS @font-face 不呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15869690/

相关文章:

css - 用 CSS 2d 变换定义一个点来缩放?

css - 嵌入式字体样式 - 嵌入式字体样式与 CSS 样式

javascript - 当拖动离开窗口时,Firefox 4 不会触发 dragleave 或 dragexit

jquery - 响应 slider 图像高度自动不接受 Chrome

html - CSS 断字 : break-all; (only for long words)?

CSS 工具提示在 WordPress 中不起作用

html - 如何仅使用 HTML 和 CSS(可能是小型 JavaScript)制作多层下拉菜单

html - float 和内联 block 元素上的省略号文本溢出

css - @字体问题

css - 应该采用什么技术来优化@font-face 渲染?