简体   繁体   中英

Index.html file CSS loading error

I just pushed a website live, and it's only loading "raw 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. It is an advisable practice to create a CSS folder in the root of your site containing all the CSS files, something like that:

在此处输入图片说明

Then you just need to slightly modify your link elements in the header:

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

I hope it was helpful!

Please double check the location of you 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

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

now if you put in a separate folder with you index.html file

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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