【问题标题】:I get mime type error when attempting to load css fonts尝试加载 css 字体时出现 mime 类型错误
【发布时间】:2021-07-16 20:33:29
【问题描述】:

我加载了一个字体,当我保存文件时出现 mime 类型错误:

我不明白到底发生了什么。

这是html代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" src="Branda-yolq.ttf">
    <title>Document</title>
</head>
<body>
    <h1 id="welcomingText">Welcome to QUIZ</h1>
    <button id="init-button">Start Quiz!</button>
    <div class="contentDivDisplayed">
        <p id='question'>question</p>
        <span><input type="radio" autocomplete="off" name="hh"><p></p></span>
        <span><input type="radio" autocomplete="off" name="hh"><p></p></span>
        <span><input type="radio" autocomplete="off" name="hh"><p></p></span>
        <span><input type="radio" autocomplete="off" name="hh"><p></p></span>
        <p id="quest-num">questionNum</p>
        <button id="next-button">Next</button>
    </div>
    <div id="alert-box"></div>
    <script src="quiz.js"></script>
</body>
</html> 

这是css代码:


@font-face {
    font-family: "skot";
    src: url("Branda-yolq.ttf");
}

【问题讨论】:

    标签: html css mime-types mime


    【解决方案1】:

    此行导致问题:

    <link rel="stylesheet" src="Branda-yolq.ttf">
    

    你告诉浏览器加载一个样式表,但是你给它一个字体文件。这就是你得到 MIME 类型错误的方式。删除该行,错误应该消失。您已经在 css 中加载字体。

    【讨论】:

      猜你喜欢
      • 2020-11-20
      • 2013-10-12
      • 2021-05-12
      • 1970-01-01
      • 2018-07-09
      • 2021-11-25
      • 1970-01-01
      • 2018-05-03
      相关资源
      最近更新 更多