I am trying to make a navbar like seen on: http://getbootstrap.com/examples/navbar/
I have the code below:
<head>
<meta charset='UTF-8' />
<link href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css' rel='stylesheet' />
</head>
<body class='container'>
<nav class="navbar navbar-inverse navbar-fixed-top" >
<div class="navbar-header">
<a class="navbar-brand" href="#">BLARG</a>
</div>
<div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">TEST</a></li>
</ul>
</div>
</nav>
<title>Splatter</title>
<div class="page-header">
<h1><%= @title %></h1>
</div>
<%= yield %>
But I get something like this:
Any ideas what I am totally messing up
3
Answers
Usually when I see a Bootstrap component in the documentation, and I want to replicate it, I just do
CTRL+U
in Chrome (or whatever shortcut you have for source viewing in your browser) and copy the code and paste it in my favorite editor and then I have that component. In your case, the mark up would be:Note that the
nav
element is wrapped in acontainer
element, that’s what you don’t want to be doing really. I’d rather just leavenav
as a direct child ofbody
.JS Fiddle
You were referencing
Bootstrap v2 stylesheet
in your head for v3 code and then had to clean the HTML markup.using
works and then working with other css classes to fully adapt the look you want . Here is a cheat sheet to help you get started cheat sheet inside the cheat sheet is a list of css classes. The code above works fully for making the navbar work the way you want just add the css class
to any of the following elements to make them transparent. So adding the following works
will make the navbar fully transparent 🙂