html - Twitter bootstrap 3 navbar navbar-right outside navbar-collapse -
in twitter bootstrap 2.3.2 can have like: http://jsfiddle.net/aqwuz/3/
<div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a href="#" class="brand">brand</a> <ul class="nav pull-right"> <li> <a href="#">fixed link</a> </li> </ul> <div class="nav-collapse"> <ul class="nav"> <li><a href="#">l1</a></li> <li><a href=#">l2</a></li> </ul> </div> </div> </div> </div>
a twitter bootstrap navbar, in mobile responsive view, "fixed link" stay visible in header.
now, in bootstrap 3, after upgrade code, can have: http://jsfiddle.net/ec3ly/4/
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">brand</a> </div> <ul class="nav navbar-nav navbar-right"> <li> <a href="#">fixed link</a> </li> </ul> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="#">l1</a></li> <li><a href=#">l2</a></li> </ul> </div> </div> </nav>
in mobile responsive view, 2 lines... tried wrap in "navbar-header" node http://jsfiddle.net/ec3ly/5/ or in first "navbar-header" without success.
what did miss?
thanks,
alexandre
the 2 lines in mobile navbar caused clearfix of navbar-header:
.navbar-header { .clearfix(); @media (min-width: @grid-float-breakpoint) { float: left; } }
you use media queries , css undo clearfix (and add new before collapsed dropdown)
.navbar-right {float: right !important;} @media(max-width:767px) { .navbar-right {margin-right:20px;} .navbar-header:after { clear: none; } .navbar-nav.navbar-right > li { float: left; } .navbar-collapse:before {clear:both;} .navbar-collapse {overflow-y: hidden;} .navbar-collapse.in {overflow-y: visible;} .navbar{border-color: #101010; border-width: 0 0 1px;} .navbar-collapse.in > ul {border-color: #101010; border-top:1px double;} } }
demo: http://bootply.com/82366
the media queries add float right navbar-right on smaller screens. take code in production, maybe fix borders , possible navbar css transisions too.
Comments
Post a Comment