PinYu
PinYu

Reputation: 61

How to use bootstrap without CDN?

I want to use bootstrap on my website. First, I put CDN in the head, and everything is fine. Then I don't want to apply bootstrap by CDN, so I download the bootstrap file, and put the CSS part in the <style>, and put the js part in the <script>. But it didn't work, why?

This is the CDN code:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">

Upvotes: 3

Views: 10713

Answers (2)

Rakesh Raj
Rakesh Raj

Reputation: 129

In your <head> section you can Link your CSS stylesheet

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

</head>

And Link Js files on

<body>
 <!-- html code -->
   <script src="js/jquery.min.js"></script>
   <script src="js/bootstrap.min.js">
 </body>

Upvotes: 2

Taufik Nur Rahmanda
Taufik Nur Rahmanda

Reputation: 1969

Follow this step:

  1. Go to https://getbootstrap.com/ and then click a big "Download" button.
  2. Scroll down to "Compiled CSS and JS" section, click "Download" button.
  3. You'll have a file named like bootstrap-4.0.0-beta-dist.zip downloaded (according to current version).
  4. Extract it. It'll have 2 folders inside: css & js.
  5. Include them on your web project directory e.g. in assets/bootstrap.
  6. Include them inside your html <head> script:
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<script src='assets/bootstrap/js/bootstrap.min.js'></script>

Good luck & keep learning!

Upvotes: 8

Related Questions