首页 > 解决方案 > 自定义 Google 字体不适用于 Flask

问题描述

我目前正在尝试使用 Google 字体在 Flask 上托管的网页上呈现自定义字体,但该字体不适用。当我在没有 Flask 的浏览器中尝试相同的 html 和 css 文件时,字体会显示。Google 字体可能无法与 Flask 一起使用的任何原因?

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://fonts.googleapis.com/css2?family=Fredoka+One" rel="stylesheet">
    <link rel="stylesheet" href="googleFonts.css">
    <title>Google Fonts</title>
</head>
<body>
    <p class="header">This is Google Fonts</p>
</body>
</html>

CSS

 .header {
    font-family: 'Fredoka One', cursive;
    font-size: 50px;
}

标签: htmlcssflaskgoogle-font-api

解决方案


推荐阅读