简体   繁体   English

Index.html文件CSS加载错误

[英]Index.html file CSS loading error

I just pushed a website live, and it's only loading "raw HTML." 我刚刚启动了一个网站,它只是加载“原始HTML”。 I've been troubleshooting on this for a few hours, and can't seem to work out why. 我已经对此进行了数小时的故障排除,似乎无法找出原因。

Here's the code: 这是代码:

<!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">

Any help would be much appreciated. 任何帮助将非常感激。

You are doing it right, the problem is that CSS files are residing in different folders. 您做对了,问题是CSS文件位于不同的文件夹中。 It is an advisable practice to create a CSS folder in the root of your site containing all the CSS files, something like that: 建议在网站的根目录中创建一个CSS文件夹,其中包含所有CSS文件,如下所示:

在此处输入图片说明

Then you just need to slightly modify your link elements in the header: 然后,您只需要稍微修改标题中的link元素即可:

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

And so you could keep adding more CSS files if needed. 因此,如果需要,您可以继续添加更多CSS文件。

I hope it was helpful! 希望对您有所帮助!

Please double check the location of you css 请仔细检查您的CSS位置

if you put it in separate folder, you might want to use something like this 如果将其放在单独的文件夹中,则可能需要使用类似的内容

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

if its just in the same folder as your index.html 如果与您的index.html位于同一文件夹中

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

now if you put in a separate folder with you index.html file 现在,如果您将index.html文件放在一个单独的文件夹中

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

just take note that "../" makes you go back one folder from the current location of your index 请注意,“ ../”使您从索引的当前位置返回一个文件夹

Problem solved. 问题解决了。 I had to combine all of the files into .index.html 我不得不将所有文件合并到.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">

Type is required please check with type. 必须输入类型,请检查类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM