繁体   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