Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my Bootstrap code not working?

Tonight I decided to give Bootstrap a try (only been doing CSS/HTML for about two weeks), but I'm running into a problem. For whatever reason, it doesn't seem like my HTML doc is linking to the Bootstrap stylesheet. I used one of their dropdown code snippets, but the end result isn't stylized. Can someone see if I'm doing something wrong? Below is my HTML code.

<!DOCTYPE html>


<html lang = "en">

<head>
<title>Test</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />

</head>
<body>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>

<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
<li><a tabindex="-1" href="#">Action</a></li>
<li><a tabindex="-1" href="#">Another action</a></li>
<li><a tabindex="-1" href="#">Something else here</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="#">Separated link</a></li>
</ul>

</body>
</html>
like image 512
Tom Maxwell Avatar asked Sep 29 '12 01:09

Tom Maxwell


People also ask

Why Bootstrap is not working in my browser?

It might have to do with the space inside "HTML Project" directory. However, testing a website through the file system is, at best, inconclusive, as CBroe pointed out. In most cases, if you make it work through file system it will stop working on a web server and chances are the latter is how you want it to work.

How do I know if Bootstrap is working?

We can check Bootstrap-specific method is available or not. Syntax: var bootstrap = (typeof $(). "Bootstrap-specific method" == 'function');

Why Bootstrap is not used in CSS?

CSS is more complex than Bootstrap because there is no pre-defined class and design. Bootstrap is easy to understand and it has much pre-design class. In CSS, we have to write code from scratch. In Bootstrap, we can add pre-defined class into the code without writing code.


2 Answers

Are all the files in the right folders? You are using relative url:s, can be confusing if you just started to code. How is your folder structure? Are the index.html and the css folder in the same directory?

like image 193
Simon Avatar answered Sep 19 '22 01:09

Simon


You Need to look at the file structure of how bootstrap files are added:

http://twitter.github.com/bootstrap/getting-started.html#file-structure

like image 42
defau1t Avatar answered Sep 19 '22 01:09

defau1t