簡體   English   中英

Index.html文件CSS加載錯誤

[英]Index.html file CSS loading error

我剛剛啟動了一個網站,它只是加載“原始HTML”。 我已經對此進行了數小時的故障排除,似乎無法找出原因。

這是代碼:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <link rel="icon" type="image/ico" href="http://www.example.com/favicon.ico"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Example</title>

    <!-- Bootstrap Core CSS -->
    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Theme CSS -->
    <link href="css/freelancer.min.css" rel="stylesheet">

任何幫助將非常感激。

您做對了,問題是CSS文件位於不同的文件夾中。 建議在網站的根目錄中創建一個CSS文件夾,其中包含所有CSS文件,如下所示:

在此處輸入圖片說明

然后,您只需要稍微修改標題中的link元素即可:

<!-- Bootstrap Core CSS -->
<link href="css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet">
<!-- Theme CSS -->
<link href="css/freelancer.min.css" rel="stylesheet">

因此,如果需要,您可以繼續添加更多CSS文件。

希望對您有所幫助!

請仔細檢查您的CSS位置

如果將其放在單獨的文件夾中,則可能需要使用類似的內容

<link rel="stylesheet" type="text/css" href="../min/freelancer.min.css">

如果與您的index.html位於同一文件夾中

<link rel="stylesheet" type="text/css" href="freelancer.min.css">

現在,如果您將index.html文件放在一個單獨的文件夾中

<link rel="stylesheet" type="text/css" href="min/freelancer.min.css">

請注意,“ ../”使您從索引的當前位置返回一個文件夾

問題解決了。 我不得不將所有文件合並到.index.html中

<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">

<!-- Theme CSS -->
<link href="css/freelancer.min.css" rel="stylesheet" type="text/css">

必須輸入類型,請檢查類型。

暫無
暫無

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

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