My goal is to utilize the bootstrap navbar-fixed-top within my id="content"
div. However, when I apply the navbar-fixed-top class like this:
<nav class="navbar navbar-default navbar-fixed-top navbar-shadow">
The navbar ends up on top of everything else.
Query: How can I ensure that only the content inside my id="content"
scrolls under the navbar?
Note: Links have been updated with working code, special thanks to @Av Avt, and gratitude to everyone else who contributed.
Code Example Previews
Click Here for CodePen Code Preview
HTML
<header id="header">
<div class="container-fluid">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="img-thumbnail">
<img src="holder.js/48x48" />
</div>
Administration
</div>
</div>
</div>
</header>
<nav id="column-left">
<div id="profile">
<ul class="media-list">
<li class="media">
<div class="media-left">
<a href="#">
<img class="media-object img-circle" src="holder.js/64x64" alt="...">
</a>
</div>
<div class="media-body">
<h4 class="media-heading">John Doe</h4>
<p>Administrator</p>
</li>
</ul>
</div>
<ul id="menu">
<li><a href=""><i class="fa fa-dashboard fa-fw"></i> <span>Dashboard</span></a></li>
<li>
<a class="parent"><i class="fa fa-cog fa-fw"></i> <span>Drop Down Menu</span></a>
<ul>
<li><a href="">Link 1</a></li>
<li><a class="parent">Sub Drop Down Menu</a>
<ul>
<li><a href="">Link 2</a></li>
<li><a href="">Link 3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
<!-- navbar-fixed-top not work correct when have it in my content id -->
<div id="content">
<nav class="navbar navbar-default navbar-fixed-top navbar-shadow">
<div class="container-fluid">
<div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a type="button" id="button-menu" class="navbar-brand"><i class="fa fa-indent fa-lg"></i></a>
</div>
<div class="navbar-collapse collapse" id="navbar">
<ul class="nav navbar-nav">
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a aria-expanded="false" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle" href="#"><i class="fa fa-bell fa-lg"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
<li class="dropdown">
<a aria-expanded="false" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle" href="#"><i class="fa fa-info-circle"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
<li class="active"><a href="./">Logout <i class="fa fa-sign-out fa-lg"></i></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-lg-6 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Calender</h1>
</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/holder/2.9.0/holder.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
From a comment:
I simply want to use the navbar-fixed-top feature provided by Bootstrap but instead of having it at the top of the page as shown in their examples, I would like it to be within my content id. Additionally, I need the header div to always remain at the top.