html - css 无法以正确的方式加载字体

标签 html css

我必须从文件夹中将字体加载到 css 中,但它不起作用

html

是:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style>
        @font-face { font-family: 'HelveticaWorld'; font-style: normal; font-weight: bold; src: URL("../Fonts/HelveticaWorld-Bold.ttf") format('ttf'); }
    </style>
</head>
<body>
            <div style="margin-bottom: 15px; font-weight: bold;font-family: HelveticaWorld"">Setup</div>

</body>
</html>

download physical html file ( zip)

最佳答案

查看zip文件,你的字体路径和格式是错误的。尝试:

@font-face { font-family: 'HelveticaWorld'; font-style: normal; font-weight: bold; src: URL("font/HelveticaWorld-Bold.ttf") format('truetype'); }

关于html - css 无法以正确的方式加载字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14689937/

相关文章:

java - 传递参数 - 使用 Javascript 将 Python 转换为 HTML

html - 我的 :hover selector is interrupted by text, 我该如何解决这个问题?

CSS 转换在 webkit 中有效,但在 FF 中无效

jquery - 在悬停下拉菜单中添加 CSS3 动画

HTML Table BorderColor 在浏览器之间有很大的不同

javascript - 如何在jquery中实现mouseleave

css - W3C 如何选择 CSS 模块级别编号?

javascript - 在其外部单击时,多个模态框不会关闭

javascript - 如何通过javascript确定内部每个字符相对于页面的位置(x,y)?

javascript - 删除除主页以外所有页面的公共(public)页眉中的特定元素