Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap CDN Not Loading

A simple yet annoying error.. I can't load the Bootstrap css using the cdn Here is the simple code

         <html>
         <head>
<title>Header template</title>

<!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

      </head>
  <body>
<button class="btn btn-default">Hello World</button>
  </body>
  </html>
like image 691
Incpetor Avatar asked Apr 29 '14 06:04

Incpetor


1 Answers

Two things might cause this:

  • The obvious one is that you should remove the spaces in the first link (looks like you already edited that)

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

  • How are you viewing this file? If it is not served via a webserver (and thus over http of https) then the protocol-less links won't work. Does your browser say file:/// etc in the address bar? Then add http:// in front of //netdna.bootstrapcdn.com

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

like image 99
David De Sloovere Avatar answered Sep 27 '22 22:09

David De Sloovere