I'm new on Bootstrap, and i want to create a navbar with some stuff (links, dropdown...) and a breadcrumb. But i have a problem with the display: block (i think...) when i put a breadcrumb into a navbar, this is my example code:
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<ul class="nav navbar-nav navbar-right">
<ul class="breadcrumb list-inline">
<li><a href="#">Home</a></li>
<li><a href="#">Library</a></li>
<li class="active">Data</li>
</ul>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hello George <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Settings</a></li>
<li><a href="#">Logout</a></li>
</ul>
</li>
<li>
<span class="glyphicon glyphicon-info-sign icons-padding"></span>
</li>
<li><a href="#">Help</a></li>
<li>
<span class="glyphicon glyphicon-off icons-padding"></span>
</li>
<li><a href="#">Exit</a></li>
</ul>
</div>
</nav>
http://jsfiddle.net/calamarico/r9yEU/2/embedded/result/
How can i put inline the breadcrumb and the other stuff in the same line?
Build Responsive Website Using HTML5, CSS3, JavaScript And Bootstrap 5. Breadcrumbs are a great way to show hierarchy-based information for a site. In the case of blogs, breadcrumbs can show the dates of publishing, categories, or tags. They indicate the current page's location within a navigational hierarchy.
Dividers. Dividers are automatically added in CSS through ::before and content . They can be changed by modifying a local CSS custom property --bs-breadcrumb-divider , or through the $breadcrumb-divider Sass variable — and $breadcrumb-divider-flipped for its RTL counterpart, if needed.
A simple float: left
will do the work (margins are here to for vertical alignment) :
.nav .breadcrumb {
margin: 0 7px;
}
@media (min-width: 768px) {
.nav .breadcrumb {
float: left;
margin: 7px 10px;
}
}
Updated fiddle (I also fixed your icon bug on mobile version)
This is my solution, it works with toogle button and collapse div too:
<nav class="navbar navbar-default" role="navigation">
<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>
<!-- this is my custom breadcrumb -->
<p class="navbar-text navbar-right">
<!-- a glyphicon as homepage -->
<a class="navbar-link" href="#" title="homepage"><span class="glyphicon glyphicon-home icons-padding"></span></a>
>
<a class="navbar-link" href="#">Link1</a>
>
<a class="navbar-link" href="#">Link2</a>
>
<a class="navbar-link" href="#">Link3</a>
>
Link4
</p>
<!-- end -->
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">
<span class="glyphicon glyphicon-off icons-padding">
</span>
Exit
</a>
</li>
</ul>
</div>
</nav>
You need to edit css just to modify the link appeal:
a.navbar-link {
text-decoration: underline;
}
It works with btn too: just add, to link class, "btn btn-default btn-xs".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With