rexxar February 2016

Include bootstrap in my HTML page

I have this VERY simple line of code. I am just starting in doing some Javascript coding but I cannot make this work. Can you please tell me why?

<html>
<head>
    <script src="bootstrap.min.js"></script>
    <title>My Website</title>
</head>
<body>
    <p>This is an example of a paragraph.</p>
    <button type="button" class="btn btn-danger">Danger daw!</button>
</body>
</html>

The bootstrap is not appearing on the page.

Answers


Ognjen Babic February 2016

Add this beetween your head tags:

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">


Brian McAuliffe February 2016

Bootsrap has Javascript, CSS and an optional theme. From the Getting Started link on the bootstrap site you have the following code which will include them all for you. If you are hosting the files yourself, just update the paths to the files.

<!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>


yahoo February 2016

You should include css file path, here i used BootstrapCDN. And try to learn about bootstrap from here . I hope this is helpful.

  <html>
  <head>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <title>My Website</title>
 </head>
 <body>
   <p>This is an example of a paragraph.</p>
   <button type="button" class="btn btn-danger">Danger daw!</button>
</body>
</html>


rdn87 February 2016

U miss incldue CSS.

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>


Arun Sharma February 2016

Bootstrap requires jquery as a dependency.

Use the following code as suggested by rdn87

 <!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h1>Bootstrap</h1>
  <p>Text goes here</p>
</div>

</body>
</html>

Post Status

Asked in February 2016
Viewed 2,823 times
Voted 13
Answered 5 times

Search




Leave an answer