【问题标题】:Problema nell'importare un file CSS esterno in una pagina HTMLProblema nell'importare un file CSSesterno in una pagina HTML
【发布时间】:2020-12-29 17:29:18
【问题描述】:

我声明我是 HTML 和 CSS 世界的新手。我正在创建此页面以自定义 Altervista 上称为 not_found.html 的 404 错误,它导入样式以从名为 Style.css 的外部文件对其进行自定义。有问题的 CSS 文件位于名为 Sheets-Style 的文件夹中,而页面直接位于 Altervista 提供的空间的根目录中。

我写的代码如下:

<!DOCTYPE HTML>
<html>
  <head>
    <title>Errore - 404</title>
    <link rel="icon" href="Media/Icona.png" type="image/png"/>
    <link rel="stylesheet" type="text/css" href="Fogli-Stile/Style.css"/>
    <style type="text/css">
      .container {
        text-align: center;
        border: none;
        margin-top: 10%;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <h1>OOPS... Qualcosa &egrave; andato storto.</h1>
      <p>
        Purtroppo non siamo riusciti a trovare quello che stavi cercando.
        <br/>
        Prova a tornare alla Home e a vedere se trovi qualcosa che ti interessa.
        <br/>
        Oppure facci sapere come possiamo migliorarci.
        <br/>
      </p>
      <button class="BTN_action" onclick="location.href='index.php'">
        Torna alla Home
      </button>
      <button class="BTN_action">
        Inviami un suggerimento
      </button>
    </div>
  </body>
</html>

问题是,当我从 Chrome 打开页面时,我没有导入 css 文件,因此我选择的样式不会出现。

有没有人知道我哪里出错了?

【问题讨论】:

  • 我投票结束这个问题,因为它不是英文的。

标签: html css css-selectors


【解决方案1】:

如果我理解,您的 CSS 路径可能是错误的。试试这个:

 <link rel="stylesheet" type="text/css" href="./Fogli-Stile/Style.css"/>

如果这不起作用,那么您需要共享文件的结构。

【讨论】:

    猜你喜欢
    • 2022-07-30
    • 2022-12-05
    • 1970-01-01
    • 2021-08-10
    • 2017-06-29
    • 2017-03-02
    • 2022-12-02
    • 2022-12-28
    • 2020-08-02
    相关资源
    最近更新 更多