Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breadcrumb into a navbar in bootstrap 3.0.2

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?

like image 292
Kalamarico Avatar asked Nov 28 '13 16:11

Kalamarico


People also ask

How do I add breadcrumbs to bootstrap?

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.

How do you change breadcrumbs to dividers?

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.


2 Answers

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;
    }
}

enter image description here

Updated fiddle (I also fixed your icon bug on mobile version)

like image 90
zessx Avatar answered Oct 18 '22 18:10

zessx


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>
            &nbsp;>&nbsp;&nbsp;
            <a class="navbar-link" href="#">Link1</a>                  
            &nbsp;>&nbsp;&nbsp;
            <a class="navbar-link" href="#">Link2</a>                  
            &nbsp;>&nbsp;&nbsp;
            <a class="navbar-link" href="#">Link3</a>                  
            &nbsp;>&nbsp;&nbsp;
            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".

like image 2
s.benve Avatar answered Oct 18 '22 19:10

s.benve