Logo In Navbar, Spacing Above The Navigation List, And Below The Logo
I have been trying to code a responsive header using Bootstrap 3, I just have one. There is a space above the navigation list, and below the logo as well. How can I line up the two
Solution 1:
Structurally your html differs than my approach and from the docs on bootstrap for the navbar implementation. You put .row around col-* classes. You don't need to duplicate the logo for small and large, if it's the same image. You can also just modify the brand and positioning in the min-width. Don't know your logo widths, but you can easily adjust in the min-width what you need and, also in the min-width, adjust the padding on the parent a so that it visually is in line with the logo.
DEMO: http://jsbin.com/aXAyicIS/1/
EDIT: http://jsbin.com/aXAyicIS/1/edit
CSS
.navbar-brand {
width: 100%;
padding: 070px015px;
}
/* logo image on mobile */.navbar-brandimg {
max-width: 100%
}
.navbar-toggle {
position: absolute;
float: none;
right: 0;
top: 5px;
}
@media (min-width:768px) {
.navbar-brand {
float: none;
width: auto;
max-height: none;
padding: 0!important;
}
.navbar-header {
float: left;
margin: 0;
width: 30%;
}
/* logo image */.navbar-brandimg {
margin: 0;
max-width: 100%;
max-height: none;
}
.nav.navbar-navli.activea,
.nav.navbar-navli.activea:hover {
background: transparent
}
#nav-collapse {
float: right;
padding: 0!important;
margin: 0!important;
width: 70%;
}
}
HTML
<divclass="navbar navbar-default navbar-static-top"role="navigation"><divclass="container"><divclass="navbar-header"><buttontype="button"class="navbar-toggle"data-toggle="collapse"data-target=".navbar-collapse"><spanclass="sr-only">Toggle navigation</span><spanclass="icon-bar"></span><spanclass="icon-bar"></span><spanclass="icon-bar"></span></button><ahref="yourlink.html"class="navbar-brand"><imgsrc="http://placehold.it/300x80/444444/FFFFFF&text=LOGO"></a></div><divid="nav-collapse"class="collapse navbar-collapse"><ulclass="nav navbar-nav navbar-right"><liclass="active"><ahref="#testme1"class="anchor">Anchor 1</a></li><li><ahref="#testme2"class="anchor">Anchor 2</a></li><li><ahref="#testme3"class="anchor">Anchor 3</a></li><liclass="dropdown"><ahref="#"class="dropdown-toggle"data-toggle="dropdown">Dropdown <bclass="caret"></b></a><ulclass="dropdown-menu"><li><ahref="#">Test</a></li><li><ahref="#">Another link</a></li><li><ahref="#">Something else here</a></li><liclass="divider"></li><liclass="dropdown-header">Nav header</li><li><ahref="#">Separated link</a></li><li><ahref="#">One more separated link</a></li></ul></li></ul></div><!--/.nav-collapse --></div><!--/.container --></div><!--.navbar-->
Post a Comment for "Logo In Navbar, Spacing Above The Navigation List, And Below The Logo"