Excluding search bar from Bootstrap's navbar collapse - html

I know this question has already been asked here:
Bootstrap navbar search outside collapse.
Keeping my search bar viewable when my navbar collapses with twitter bootstrap
But mine is different in the sense that my search bar is located in the middle of other nav items, and I want all these other nav items to collapse except my search bar. I wasted a week trying to fix this, but every move I make creates a mess.
This is how my navbar looks:
https://postimg.org/image/7x623zbdi3/
HTML:
<div class="container" id="responsiveContainer">
<!-- Title -->
<div class="navbar-header pull-left">
<a class="navbar-brand" href="{% url 'index' %}"> abc </a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right" id="nav">
<li id="nav-form">
<form class="navbar-form">
<div class="form-group">
<input type="text" id="searchBox" class="form-control">
<button id="search" type="submit" class="btn btn-default"><span> <i class="fa fa-search"></i> </span></button>
</div>
</form>
</li>
<li class="dropdown">
Sign In/Up <b class="caret"></b>
<ul class="dropdown-menu" class="dropdownMenu">
<li> Sign Up </li>
<li> Sign In </li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-left" id="nav">
<li> Article </li>
<li> Contact </li>
</ul>
</div>
</div>
</nav>
Custom CSS:
#nav-form {
margin-right: -30px;
}
#nav input {
background-color: #D3212D;
color: white;
border: 1px solid #E32636;
}
#nav button {
background-color: #D3212D;
color: white;
border-radius: 60px;
border: 1px solid maroon;
box-shadow: 0px 0px 1px black;
font-family: FontAwesome;
font-size: 16px;
}
#nav button:hover {
background-color: #cd1b27;
box-shadow: 0px 0px 5px black;
}
input#search, select.form-control {
background: transparent;
border: none;
border-bottom: 1px solid #000000;
box-shadow: 0px 0px 5px orange;
}
#navbarToggle {
background-color: #E32636;
margin-top: 0px;
border: 1px solid #E32636;
}
#navbarToggle:hover, #navbarToggle:focus {
text-shadow: 0px 0px 1px rgb(32,42,62);
background-color: #E32636;
}

One of those articles you referenced does it here.
The person took the
< form... /form>
section and put it in it's own div. The key is to keep it out of the class="collapse navbar-collapse"

After a lot of debugging I finally found the solution and here it is:
HTML:
<!-- Navigational Bar -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" id="navbarToggle">
<span class="sr-only">Toggle navigation</span>
<span><i class="fa fa-list fa-2x"></i></span>
</button>
<div class="container" id="responsiveContainer">
<!-- Title -->
<div class="navbar-header pull-left">
<a class="navbar-brand" href="{% url 'index' %}"><img id="navbar-logo" src="/static/media/Images/ditookcolored.png"></a>
</div>
<div class="navbar-header pull-right">
<!-- <button class="btn btn-default" id="mobileSearch"><i class="fa fa-search"></i></button> -->
<ul class="nav navbar-nav navbar-right" id="nav">
<li id="nav-form">
<form class="navbar-form navbar-center" id="navbarForm">
<div class="form-group">
<input type="text" placeholder="Search Ditook" id="searchBox" class="form-control">
<button id="search" type="submit" class="btn btn-default"><span> <i class="fa fa-search"></i> </span></button>
</div>
</form>
</li>
</ul>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right" id="nav">
<!-- <li id="nav-form">
<form id="navbarForm">
<div class="form-group">
<input type="text" placeholder="Search Ditook" id="searchBox" class="form-control">
<button id="search" type="submit" class="btn btn-default"><span> <i class="fa fa-search"></i> </span></button>
</div>
</form>
</li> -->
<li class="dropdown">
<i class="fa fa-arrow-circle-down"></i> Sign In/Up
<ul class="dropdown-menu">
<li><i class="fa fa-user-plus"></i> Sign Up </li>
<li><i class="fa fa-sign-in"></i> Sign In </li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-left" id="nav">
<li><i class="fa fa-list-alt"></i> Article </li>
<li><i class="fa fa-phone"></i> Contact </li>
</ul>
</div>
</div>
</nav>
This actually fixed my problem:
Custom CSS:
#nav input {
position: static;
margin-left: -400px;
}
#nav button {
position: static;
margin-left: -1px;
height: 35px;
}

Related

how to put icons in line with other a tags?

i have just started learning web development and I have been facing a few issues related to the alignment of tags, buttons and icons.
Here are the issues I'm facing:
The brand name is not in line with the a tags. i tried display:inline; in every class but its not working.
the social media tags are hanging in mid air, I want them to be in line with the a tags. Again, i tried reducing the margin, padding and using the inline command but nothing seems to be working.
the bootstrap search button is also hanging mid air. I want all the above three to be in line.
Here's a screenshot of the page.
And here's the code
header {
background: #669999;
color: white;
padding: 5px 5px 5px 15px;
}
.fontsize {
color: white;
margin: 0px 0px 0px 10px;
font-size: 25px;
padding: 5px;
}
.icon {
float: right;
list-style-type: none;
margin: 0px 10px 0px 10px;
padding: 5px;
display: inline;
}
body {
margin: 0px;
}
.colors {
margin: 5px 10px 5px 10px;
padding: 10px;
color: white;
}
a:hover.colors {
color: black;
text-decoration: none;
}
.picturefont {
font-size: 25;
font-style: italic;
}
.whitespace {
padding: 10px;
margin: 50px;
}
#margin {
margin: 0px;
}
.frontpageimage {
width: 90%;
display: inline;
border: 1px solid black;
}
<h1 class="fontsize"> Brand name </h1>
<nav>
<a class="colors" href="home.html"> Home </a>
<a class="colors" href="contact.html"> Contact </a>
<a class="colors" href="recipe.html"> Recipes </a>
<a class="colors" href="order.html"> Order </a>
<ul>
<li class="icon">
<img src="icon-insta.png">
</li>
<li class="icon">
<img src="fb-icon.png">
</li>
<li class="icon">
<img src="phone-icon.png">
</li>
</ul>
</nav>
<form id="margin" class="navbar-form navbar-right">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<!-- <li>Link</li> -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<body>
<div class="row">
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="oreo-cake.jpg"></a> Chocolate Cake</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="kitkat-cake.jpg"></a> Rasberry Sponge Cake
</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="green-cake.jpg"></a> Red Velvet Cake</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="KitKatCake3.jpg"></a> Mango Rose Tart
</div>
</div>
<div id="slider">
<div id="slider2">
<img id="choclatecake" src="oreo-cake.jpg" alt="Moist Chocolate Cake" />
<img id="choclatecake" src="kitkat-cake.jpg" alt="Moist Chocolate
Cake" />
<img id="choclatecake" src="green-cake.jpg" alt="Moist Chocolate Cake" />
<img id="choclatecake" src="KitKatCake3.jpg" alt="Moist Chocolate
Cake" />
</div>
</div>`
Forgive me for the improper format but I'm new here. Hoping to find some answers. Thanks
From my experience, the best way to organize the layout of a web page is to use tables (rows and columns). Start by sketching the layout and imagining boundaries around the items of your website.
I suggest that you use Bootstrap stylesheet by including the CSS file at your page header
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Then using the CSS classes row and .col-md-* for div containter element classes.
Refer to the page (https://getbootstrap.com/docs/3.3/css/#grid-example-basic) for code examples.
Your structure might be something like the following:
<div class="row">
<div class="col-md-8">Brand name</div>
<div class="col-md-4">social media tags</div>
</div>
<div class="row">
<div class="col-md-6">navigation</div>
<div class="col-md-6">search</div>
</div>
<div class="row">
<div class="col-md-12">Body</div>
</div>
You need to put h1 tag inside nav tag.
You have closed the nav tag before starting form and you have another closing nav tag later.
Same reason as above.
Try it like this:
<nav>
<h1 class="fontsize"> Brand name </h1>
<a class="colors" href="home.html"> Home </a>
<a class="colors" href="contact.html"> Contact </a>
<a class="colors" href="recipe.html"> Recipes </a>
<a class="colors" href="order.html"> Order </a>
<ul>
<li class="icon">
<img src="icon-insta.png">
</li>
<li class="icon">
<img src="fb-icon.png">
</li>
<li class="icon">
<img src="phone-icon.png">
</li>
</ul>
<form id="margin" class="navbar-form navbar-right">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</nav>
#Student, you have a lot going on here, but most of your issues revolve around malformed HTML. So let's go through your issues one-by-one.
1) The brand name is not in line with the a tags. i tried
display:inline; in every class but its not working.
I'm only seeing your use of display:inline in a couple of your classes, but not on the brand name. Regardless, Bootstrap already has a brand with links built in for you. As you can see in the code below.
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button class="navbar-toggle collapsed" aria-expanded="false" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand Name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Contact</li>
<li>Recipes</li>
<li>Orders</li>
</ul>
...
2) The social media tags are hanging in mid air, I want them to be in
line with the a tags. Again, i tried reducing the margin, padding and
using the inline command but nothing seems to be working.
To get these to go on the same line, you can nest the form and the social media icons in a div tag that pulls both of them to the right of the navigation bar using the navbar-right class. To make sure they're on the same line, use Bootstrap's float class: pull-left and pull-right. You'll need to add padding to the top of the a tags using padding-top CSS property. I've done it to one, so you can get an idea of how.
<div class="navbar-right">
<form class="navbar-form pull-left">
<div class="form-group">
<input class="form-control" type="text" placeholder="Search">
</div>
<button class="btn btn-default" type="submit">Submit</button>
</form>
<ul class="nav navbar-nav pull-right">
<li>
<img src="fb-icon.png">
</li>
<li>
<img src="phone-icon.png">
</li>
<li>
<img src="icon-insta.png">
</li>
</ul>
</div>
You'll just need to reapply some of your classes.

Show a form on a line following the collapsed navbar

Here is my current code: https://www.bootply.com/EJSJ6aQh6Q
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span>...</span>
</button>
<a class="navbar-brand">Brand</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Bar<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a>A</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Foo<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a>A</a></li>
</ul>
</li>
<li>
<a>Subscribe</a> </li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a id="registerLink">Register</a></li>
<li><a id="loginLink">Sign In</a></li>
</ul>
<form class="nav navbar-form navbar-right col-md-6" id="autocompleteSearchForm" method="get" role="search">
<div class="input-group input-group-circle input-group-sm" role="search" id="searchGroup">
<span><div class="tt-menu" style="position: absolute; top: 100%; left: 0px; z-index: 100; display: none;"><div class="tt-dataset tt-dataset-songs"></div></div></span>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search text-success"></i></button>
</span>
</div>
</form>
</div>
</div>
Currently, when collapsed, the search bar falls under the collapsed section. I would like the search bar to be outside of the collapsed section, but not on the same line as the navbar-brand and collapse button. If I move the form inside the navbar-header div, it accomplishes what I want, but the margins are all messed up because bootstrap still thinks the search bar is on the same line as the other items.
Is there a way to do this better, or will I just have to move it to the navbar-header and fix the formatting issues that pop up?
Is this what you looking for ? It is still a rough fix using css. I have interchanged the position of form block along with a css fix. Other responsive tweek can be made for other screen devices.
https://www.bootply.com/pGDMXu2Q2R#
HTML:
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span>...</span>
</button>
<a class="navbar-brand">Brand</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Bar<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a>A</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Foo<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a>A</a></li>
</ul>
</li>
<li>
<a>Subscribe</a> </li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a id="registerLink">Register</a></li>
<li><a id="loginLink">Sign In</a></li>
</ul>
</div>
<form class="nav navbar-form navbar-right col-md-6" id="autocompleteSearchForm" method="get" role="search">
<div class="input-group input-group-circle input-group-sm" role="search" id="searchGroup">
<span class="twitter-typeahead" style="position: relative; display: inline-block;"><input autocomplete="off" class="form-control typeahead-search tt-hint" type="text" value="" readonly="" spellcheck="false" tabindex="-1" dir="ltr" style="position: absolute; top: 0px; left: 0px; border-color: transparent; box-shadow: none; opacity: 1; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);"><input autocomplete="off" class="form-control typeahead-search tt-input" id="home-search" name="searchString" placeholder="Search..." type="text" value="" spellcheck="false" dir="auto" style="position: relative; vertical-align: top; background-color: transparent;"><pre aria-hidden="true" style="position: absolute; visibility: hidden; white-space: pre; font-family: "Open Sans", Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; word-spacing: 0px; letter-spacing: 0px; text-indent: 0px; text-rendering: auto; text-transform: none;"></pre><div class="tt-menu" style="position: absolute; top: 100%; left: 0px; z-index: 100; display: none;"><div class="tt-dataset tt-dataset-songs"></div></div></span>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search text-success"></i></button>
</span>
</div>
</form>
</div>
CSS:
/* CSS used here will be applied after bootstrap.css */
#media (min-width:768px) {
.navbar-form{
position: absolute;
right: 135px;
top: 0;
}
}
#media (max-width:767px){
.twitter-typeahead{
display:block !important;
}
}

IE creates unnecessary offset on menu subitems

I'm using a bootstrap template called sb admin 2 as reference to a project.
For some reason only in IE (as always) it has a problem with an offset being created upon the submenus. Using the inspect I could see that when I marked the line-height property off and then on again, it became the same as the other browsers.
IE:
FF:
The menu it's a plugin called metismenu, and I saw at the sb admin 2 source code a piece of javascript that seems to fix the problem but didn't work for me.
I'm using the IE11 version, but I guess it'll be the same error at others.
Here's the fiddle:
https://jsfiddle.net/macmessa/ubqqs70c/
$(document).ready(function() {
/* BootStrap */
$(".menu4").addClass("navbar-default sidebar navbar-collapse").attr("role", "navigation");
$(".menu4").addClass("navbar-collapse collapse in");
$(".menu4").attr("aria-expanded", "true");
$(".menu4 ul").addClass("nav");
$(".menu4 ul ul").addClass("nav-second-level");
$(".menu4 ul ul ul").addClass("nav-third-level");
$(".menu4 li.itemPai a:not(.isParent)").append('<span class="fa arrow"></span>');
// Plugin
$('.menu4').metisMenu();
});
.menu4 ul li a {
cursor: pointer;
}
.sidebar .sidebar-nav.navbar-collapse {
padding-right: 0;
padding-left: 0;
}
.sidebar ul {
width: 100%;
}
.sidebar ul li {
border-bottom: 1px solid #e7e7e7;
}
.sidebar ul li a.active {
background-color: #eee;
}
.sidebar .arrow {
float: right;
}
.sidebar .fa.arrow:before {
content: "\25BA";
}
.sidebar .active>a>.fa.arrow:before {
content: "\25BC";
}
.sidebar .nav-second-level li,
.sidebar .nav-third-level li {
border-bottom: 0!important;
}
.sidebar .nav-second-level li a {
padding-left: 37px;
}
.sidebar .nav-third-level li a {
padding-left: 52px;
}
#media(min-width:768px) {
.menu4 {
width: 250px !important;
}
.sidebar {
z-index: 1;
position: absolute;
margin-top: 51px;
}
.navbar-right li {
margin-left: auto;
}
}
#media(max-width:768px) {
.menu4 {
width: auto;
}
.sidebar {
z-index: 1;
position: absolute;
width: 100%;
}
.navbar-right li {
float: left;
}
}
.navbar-right {
margin-right: 0 !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/metisMenu/2.5.2/metisMenu.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/metisMenu/2.5.2/metisMenu.min.js"></script>
<div id="pagina" class="container-fluid">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Navegação</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" target="_blank">
<img alt="" src="/Compartilhado/Images/logo.png" height="20" />
</a>
<a class="navbar-brand" href="/PM1.MVC/">
Projeto Modelo
</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-envelope-o fa-fw"></i>
<span class="badge">42</span>
<i class="fa fa-caret-down"></i>
</a>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-usuario">
<li><i class="fa fa-user fa-fw"></i> Perfil do Usuário</li>
<li><i class="fa fa-gear fa-fw"></i> Configurações</li>
<li class="divider"></li>
<li><i class="fa fa-sign-out fa-fw"></i> Logoff</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-support fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-ajuda">
<li><i class="fa fa-book"></i> Manual</li>
</ul>
</li>
</ul>
<div class="menu4" id="mnuPrincipal">
<ul>
<li class="itemPai"><a id="mnuExemplo">Exemplo</a>
<ul>
<li><a class="isParent" href="/PM1.MVC/Menu" id="mnuExemploMenu">Menu</a></li>
<li><a class="isParent" href="/PM1.MVC/Controle" id="mnuExemploControle">Controle</a></li>
<li class="itemPai"><a id="mnuExemploMensagem">Mensagem</a>
<ul>
<li><a class="isParent" href="/PM1.MVC/MensagemAlerta" id="mnuExemploMensagemAlerta">Alerta</a></li>
<li><a class="isParent" href="/PM1.MVC/MensagemNotificacao" id="mnuExemploMensagemNotificacao">Notificacao</a></li>
</ul>
</li>
<li><a class="isParent" href="/PM1.MVC/MapaMetropolitano" id="mnuExemploMapaMetropolitano">Mapa Metropolitano</a></li>
<li><a class="isParent" href="/PM1.MVC/TratamentoErro" id="mnuExemploTratamentoErro">Tratamento de Erro</a></li>
</ul>
</li>
<li class="itemPai"><a id="mnuCadastro">Cadastro</a>
<ul>
<li><a class="isParent" href="/PM1.MVC/Usuario" id="mnuCadastroPesquisaOtimizada">Pesquisa Otimizada</a></li>
<li><a class="isParent" href="/.PM1.MVC/Item" id="mnuCadastroExemploCRUD">Exemplo CRUD</a></li>
</ul>
</li>
<li class="itemPai"><a id="mnuRelatorio">Relatório</a>
<ul>
<li><a class="isParent" id="mnuRelatorioExemplo">Exemplo de Relatório</a></li>
</ul>
</li>
<li class="itemPai"><a id="mnuUtilitario">Utilitário</a>
<ul>
<li><a class="isParent" href="/.PM1.MVC/Configuracao" id="mnuUtilitarioConfiguracao">Configuração</a></li>
<li><a class="isParent" id="mnuUtilitarioNotificacao">Notificação para Usuário</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="conteudo">
</div>
</div>
<div class="modal fade" id="divModalPerfilUsuario" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Perfil do Usuário</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<p>
Nome:
<br /> USER
</p>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<p>
Login:
<br /> USR1
</p>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<p>
Empresa:
<br /> C
</p>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<p>
Área:
<br />
</p>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<img alt="foto" src="/Compartilhado/Images/usuarioNaoIdentificado.png" width="75" height="90" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</div>
You can try to put:
.sidebar ul li {
border-bottom: 1px solid #e7e7e7;
line-height:0;
color:transparent;}
and
.menu4 ul li a {
cursor: pointer;
line-height:1.45em;
}
Preview at: https://jsfiddle.net/ubqqs70c/4/

On a two level bootstrap navbar, I cannot make the top part stay fixed

With bootstrap, I'm creating a two level Navbar, and I want the top part, the dark blue one, to stay fixed when scrolling, but when I give .navbar-default .navbar-collapse a position:fixed, the middle part gets chopped off. Any idea of why this happens and how I could fix it?
This is my code:
<header id="header">
<nav class="navbar navbar-default hidden-sm hidden-xs" role="navigation">
<div class="navbar-collapse navbar-azul">
<ul class="nav navbar-nav navbar-left navbar-azul">
<li class="uppercase">One</li>
<li class="uppercase">Two</li>
<li class="uppercase">Three</li>
<li class="uppercase">Four</li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-azul">
<li class="white"><i class="fa fa-facebook" ></i></li>
<li><i class="fa fa-twitter" ></i></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-youtube-play"></i></li>
<li><i class="fa fa-play-circle-o"></i>Videos
</li>
<li><i class="fa fa-television"></i>Shows
</li>
</ul>
</div>
</nav>
<div class="navbar navbar-inverse" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<h1><img src="images/logo.png" class="logohead img-responsive" alt="logo"></h1>
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left navbar-celeste-text">
<li>Menu 1</li>
<li>Menu 2</li>
<li class="dropdown ">Menu 3 <i class="fa fa-angle-down"></i>
<ul role="menu" class="sub-menu">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</li>
<li>Menu 3</li>
<!-- <li>Antigua Sports</li> -->
<li>Menu 4</li>
<li class="uppercase visible-sm-block visible-xs-block">One Small Screen</li>
<li class="uppercase visible-sm-block visible-xs-block">Two Small Screen</li>
<li class="uppercase visible-sm-block visible-xs-block">Three Small Screen</li>
<li class="uppercase visible-sm-block visible-xs-block">Four Small Screen</li>
<li class="visible-sm-block visible-xs-block"><i class="fa fa-play-circle-o"></i>Videos</li>
<li class="visible-sm-block visible-xs-block"><i class="fa fa-television"></i>Shows</li>
<li class="visible-sm-block visible-xs-block">
<div class="search">
<form role="form">
<i class="fa fa-search"></i>
<div class="field-toggle">
<input type="text" class="search-form" autocomplete="off" placeholder="Search">
</div>
</form>
</div>
</li>
</ul>
</div>
<div class="search hidden-sm hidden-xs">
<form role="form">
<i class="fa fa-search"></i>
<div class="field-toggle">
<input type="text" class="search-form" autocomplete="off" placeholder="Search">
</div>
</form>
</div>
</div>
</div>
And the CSS:
#header{
margin-bottom: 0;
padding: 0 0 30px 0;
margin: 0 auto;
width:100%;
z-index:999;
background:#00b1ec;
}
#header .navbar-inverse .container{
position: relative;
}
.pull-right {
right:50px;
position:absolute;
top:15px
}
#header .navbar {
border: 0;
margin-bottom: 0;
}
#header .navbar-toggle{
margin-top: 20px;
}
#header .navbar-brand{
padding: 0;
margin-left: 0;
}
#header .navbar-brand h1{
padding: 0;
margin: 0;
}
#header .navbar-nav.navbar-left >li:last-child{
margin-left: 20px;
}
#header .navbar-nav.navbar-left >li a {
color: #fff;
font-weight: 400;
}
.navbar-default .navbar-collapse {
position: fixed;
z-index: 999;
}
.navbar-default .navbar-collapse, .navbar-inverse .navbar-nav>li>a {
color: #fff;
}
.navbar-azul-text {
color: #fff;
font-size: 14px;
}
.navbar-celeste-text{
color: #fff;
font-size: 18px;
}
.navbar-default .navbar-nav>li>a{
color:#fff;
}
#header .navbar-inverse .navbar-nav li.active > a,
#header .navbar-inverse .navbar-nav li.active > a:focus,
#header .navbar-nav.navbar-left li > a:hover,
.navbar-inverse .navbar-nav > .open > a,
.navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
background-color: inherit;
border: 0;
color: #E61F47;
}
You have two choices:
Add navbar-fixed-top class to nav tag with navbar class and remove your css with position: fixed.
Add width: 100% to your CSS (.navbar-default .navbar-collapse).

CSS: How to fix overlapping divs

I am using bootstrap to create a web site.
Here is the code for navbar
Edit: Fiddle http://jsfiddle.net/cb6rxu2h/
<header>
<nav class="navbar navbar-fixed-top navbar-inverse">
<div class="container-fluid">
<div class="navbar-header col-md-4 col-sm-12">
<a class="navbar-brand" href="#">BargainKart</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="badge pull-right">4</span><i class="fa fa-shopping-cart"></i>
</a></li>
<li><a href="#" data-toggle="modal" data-target="#myModal"><i class="fa fa-sign-in"></i>
Sign in</a></li>
</ul>
</div> <!--container fluid-->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav pull-right">
<li>About</li>
<li class="dropdown">
Categories <span class="caret"></span>
<ul class="dropdown-menu">
<li>Electronics</li>
<li>Fashion</li>
<li role="separator" class="divider"></li>
<li>All</li>
</ul>
</li>
</ul>
<div class="col-sm-6 col-md-3 pull-right">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i>
</button>
</div>
</div>
</form>
</div>
</div><!-- /.navbar-collapse -->
</nav>
</header>
And the code for sidebar
<div class="wrapper">
<aside>
<div class="categories-bar content-fluid col-md-3 col-sm-12">
<ul class="nav nav-pills nav-stacked">
<li class="active">Home</li>
<li>About</li><li class="active">Home</li>
<li>About</li><li ">Home</li>
<li>About</li> <li>Shop</li>
</ul>
</div>
</aside>
The css I've used is
aside {
padding-bottom: 5000px;
margin-bottom: -5000px;
background-color: white;
font-size: 1.5em;
}
.wrapper {
position: relative;
overflow: hidden;
}
I've messed up a lot but still can't figure out why the sidebar and wrapper div is overlapping into header.
I can use padding but when I scale the browser there's lot of empty space for small screen browsers.
Since you use the navbar-fixed-top giving the body a padding of the navbars height should fix this problem. Replace XX with your value of the height in pixels.
body {
padding-top: XXpx;
}
You can get this tip here.