Bootstrap Css Not Loading

Bootstrap Css Not Loading

I've been experimenting with Twitter Bootstrap and have run into a problem I cannot resolve. Basically, I have a very simple HTML file (based on the beginning of this tutorial: ) and I can open the file, but it is not loading the CSS.

I've tried this locally as well as from my web server and in both instances, the CSS does not load. This tutorial has some errors on where quotes go which I've fixed, but I've had the same problems with another tutorial.

index.html is located in the same folder as the CSS folder.

Here is my HTML:

<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>

<body>
<h1>Hello, world!</h1>

<script src="//"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

Please for the love of God help me before I destroy my Macbook.

2

7 Answers

Try using bootstrap.css instead of bootstrap.min.css. Also, make sure that it's in the correct path.

Another thing you can try as well is using media="all" instead of media="screen" in your link specifications.

Your javascript link tag for jQuery looks suspicious. Either give a relative path on your local directory, or the absolute path to an external url.

10

I had the same problem but it was unique, not sure if other had the same issue. I had "rel=" before the "href=". Just swapping the places, i.e. "href=" before "rel=" resolved the issue. Thanks a ton for the correct syntax.

1

I followed below steps to load or apply Boostrap css.

first check bootstrap available in node_modules?

If you don't see, Install bootstrap with below command

npm i bootstrap

After installation successful, verfiy again boostrap in node_modules. enter image description here

next open your project styles.css file and import below line.

@import '~bootstrap/dist/css/bootstrap.css';
1

when you upload the bootstrap files to your hosting, make sure to upload ALL the files even the .map files. I did that and it worked for me.

1

I had the same problem and I solved it.

open your file in windows notepad, choose save_as > Beside the Save button , open Encoding dropdown and choose UTF-8 !

my file was saved in Unicode Encoding. I used windows notepad to save-as my file in a UTF-8 Encoding and the issue was gone.

you may also use notepad++ to change the encoding of a file. good luck

I found this answer because it was the top google search yet I had this problem for a completely different reason.

For those who might have made the same mistake I have, remember to add

<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">

or some reference to another version of bootstrap so that your code knows where to get all the bootstrap related information

Sounds like this is just a simple directory issue. You are saying you have the HTML file and the CSS file in the same folder right? Then to load the file link it like this:

<link href="bootstrap.min.css" rel="stylesheet" media="all">

Else If your css file is in a "css" folder then change the directory to:

<link href="css/bootstrap.min.css" rel="stylesheet" media="all">

If worse comes to worse use the external link instead for troubleshooting:

<link rel="stylesheet" href="">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.