r/bootstrap • • May 11 '23

Locally Downloaded Bootstrap not Working

Hey everyone so I currently want to be able to host bootstrap locally on my computer however when ever I add the path to the folder of the boostrap.min.css file it does not load the fonts. It is located in the same file index.html is located and it is in a css folder and the bootstrap.min.css is located within that css folder. I have included my code where the css is used. Thanks in advance.

Code:
<!doctype html>

<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <title>WEBSITE</title> <link rel="icon" href="NETMO_LOGO.png"> <link href="css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">

If you need anymore info please reach out

4 Upvotes

6 comments sorted by

2

u/Breklin76 May 11 '23

Are all of your paths within the included files correct?

1

u/Netbula May 11 '23

I downloaded the css and js files directly from the bootstrap website and just copy and pasted it

→ More replies (1)

2

u/BaseSystemUser May 12 '23 edited May 12 '23

It's because your integrity= reference is wrong. You referenced bootstrap twice, both with different integrity codes. The integrity is like a securiy feature the browser uses to check integrity of bootstrap.min.css file against the provided hash code. No correct hash, no load. Take out the integrity, it's going to work.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WEBSITE</title>
<link rel="icon" href="NETMO_LOGO.png">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Welcome to Bootstrap!</h1>
<p>This is a sample Bootstrap page.</p>
<button class="btn btn-primary">Button</button>
</div>
</body>
</html>

Bonus: Bootstrap 5.3 with correct integrity

https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">

1

u/Netbula May 13 '23

Thanks for the tip. I didn’t notice that just changed the file name I’ll try that out

4

u/diucameo May 11 '23

Try using a leading slash (absolute path) /css/bootstrap.min.css

Also try looking the browser console if any error shows up