网站加载时,字体族“Poppins”在我的网站上无法正常工作

7

首先,我要感谢这个网站的所有优秀人才。没有SO的帮助,我会迷失方向。

我正在尝试引用来自Google字体的排版。问题是,当我推送更改时,字体将在控制台上显示,但不会呈现在实际网站上。

以下是我将代码导入的方式:

<style>
@import url('https://fonts.googleapis.com/css?family=Poppins:400,700,900');
</style>

.text{ 
    font-family: 'poppins-bold', sans-serif !important;
    font-size: 6.3rem;
    line-height: 1.333;
    margin-top: 0;
    color: #FFFFFF;
    text-align: center;
}

请访问此网站,自行了解。

有什么方法可以修复这个问题吗?

3个回答

8

只需添加

    <style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap');
</style>

然后在CSS内部

   *{
font-family: 'Poppins', sans-serif;
}

3
你可以尝试将以下链接添加到 index.html(主 HTML 文件)中,然后您可以使用字体族为 'poppins'。
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Poppins" />

(您需要使用 <> 将其包装成标签)


0
*{font-family:Poppins,sans-serif;font-weight:700}

1
目前你的回答不够清晰,请编辑并添加更多细节,以帮助其他人理解它如何回答问题。你可以在帮助中心找到有关如何编写好答案的更多信息。 - Community

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接