首页 > 解决方案 > 如何更改css中的字体?

问题描述

我想设计一个简单的网站,但我一直在努力改变字体。我看了很多教程并阅读了文档,但我不明白我做错了什么!

这是我的html:

<html>
<head>
    <title>My website</title>
    <link rel='stylesheet' href="style.css">

</head>
<body>
    <p class="par">Perchè non si riesce a cambiare font??</p>
</body>

这就是 style.css

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

.par {
    font-size: 100px;
    font-family: Inter;
}

我真的不知道如何使它工作。

我目前正在 Windows 10 上的 Firefox 和 Chrome 浏览器(均已更新)上对其进行测试

你们知道我做错了什么吗?

谢谢!

标签: htmlcssfonts

解决方案


确保 URL 拼写正确。


推荐阅读