出于某种原因,我无法让我的字体出现在页面上。我正在从我计算机上的静态页面打开它。 html、css 和字体都在同一个文件夹中。我试过在字体位置前添加“./”和“/”,但没有用。正在加载 CSS 文件。想法?
字体.css
@font-face {
font-family: 'American-Typewriter';
src: url('american-typewriter.eot');
src: url('american-typewriter.eot?#iefix') format('embedded-opentype'),
url('american-typewriter.woff2') format('woff2'),
url('american-typewriter.woff') format('woff'),
url('american-typewriter.ttf') format('truetype'),
url('american-typewriter.svg#american_typewriterregular') format('svg');
font-weight: normal;
font-style: normal;
}
.American-Typewriter {
font-family: 'American-Typewriter';
}
网页.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="font.css">
</head>
<body>
<h1 class='American-Typewriter'> American-Typewriter </h1>
</body>
</html>
最佳答案
我认为这是寻址的问题。 尝试仅使用/
关于html - 网页字体不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50884401/