簡體   English   中英

HTML 文件未鏈接到 CSS 文件

[英]HTML file not linking to CSS file

html 文件未鏈接到 css 文件。 這兩個文件並排放置在同一目錄中。 之前還好好的,突然就不行了。 我已經嘗試了 StackOverflow 中類似問題的答案中提到的所有內容,但仍然無效。

html代碼:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->
  <link href="https://fonts.googleapis.com/css?family=Poppins:200,400,600&display=swap" rel="stylesheet">
  <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
  <link rel="stylesheet" href="style.css">
  <title>Frontend Mentor | Four card feature section</title>

  <!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
  <style>
    .attribution { font-size: 11px; text-align: center; }
    .attribution a { color: hsl(228, 45%, 44%); }
  </style>
</head>
<body>
  <div class="container">
    <div class="part1">
      <p>Reliable, efficient delivery</p>
      <h2>Powered by Technology</h2>
      <p> Our Artificial Intelligence powered tools use millions of project data points to ensure that your project is successful.</p>
    </div>
    <div class="part2">
    <div class="supervisor">
      <h3>Supervisor</h3>
      <p>Monitors activity to identify project roadblock.</p>
    </div>
    <div class="wrapper">
    <div class="teambuilder">
      <h3>Team Builder</h3>
      <p>Scans our talent network to create the optimal team for your project.</p>
    </div>
    <div class="karma">
      <h3>Karma</h3>
      <p>Regularly evaluates our talent to ensure quality.</p>
    </div>
    </div>
    <div class="calculator">
      <h3>Calculator</h3>
      <p> Uses data from past projects to provide better delivery estimates.</p>
    </div>

  </div>
  </div>
  <footer>
    <p class="attribution">
      Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. 
      Coded by <a href="#">Your Name Here</a>.
    </p>
  </footer>
</body>
</html>

css代碼:

body {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
   background-color: hsl(0, 0%, 98%);
   text-rendering: optimizeLegibility;
}

.container {
   width: 60%;
   height: 60%;
} 

文件夾結構請參考這個https://github.com/swethalakshmi22/four-card-feature-section

你上傳到 Github 的代碼有 href="/style.css" 請寫

這里你在問題中的代碼很好。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->
  <link href="https://fonts.googleapis.com/css?family=Poppins:200,400,600&display=swap" rel="stylesheet">
  <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
  <link rel="stylesheet" href="style.css">
  <title>Frontend Mentor | Four card feature section</title>

  <!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
  <style>
    .attribution { font-size: 11px; text-align: center; }
    .attribution a { color: hsl(228, 45%, 44%); }
  </style>
</head>
<body>
  <div class="container">
    <div class="part1">
      <p>Reliable, efficient delivery</p>
      <h2>Powered by Technology</h2>
      <p> Our Artificial Intelligence powered tools use millions of project data points to ensure that your project is successful.</p>
    </div>
    <div class="part2">
    <div class="supervisor">
      <h3>Supervisor</h3>
      <p>Monitors activity to identify project roadblock.</p>
    </div>
    <div class="wrapper">
    <div class="teambuilder">
      <h3>Team Builder</h3>
      <p>Scans our talent network to create the optimal team for your project.</p>
    </div>
    <div class="karma">
      <h3>Karma</h3>
      <p>Regularly evaluates our talent to ensure quality.</p>
    </div>
    </div>
    <div class="calculator">
      <h3>Calculator</h3>
      <p> Uses data from past projects to provide better delivery estimates.</p>
    </div>

  </div>
  </div>
  <footer>
    <p class="attribution">
      Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. 
      Coded by <a href="#">Your Name Here</a>.
    </p>
  </footer>
</body>
</html>
  1. 檢查您的 code-snippet 后,似乎 css style.css 不在您的 html 文件所在的同一位置。 請檢查一下。
  2. 您能否檢查文件夾(IIS_USER)上的權限必須對此具有讀取 style.css 的權限嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM