Bootstrap > Navbar

Navbar right in Bootstrap

How to move the text to right side in navbar using Bootstrap


navbar right

We use navbar-right to move the text to right side of the navbar

  <h2><i>Inverted navbar with right aligned</i></h2>
        <nav class="navbar navbar-inverse"> 
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">TechFunda</a>
                </div>
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">HTML5</a></li>
                    <li><a href="#">CSS</a></li>
                    <li><a href="#">JavaScript</a></li>
                    <li><a href="#">Bootstrap</a></li>
                </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#"><span class="glyphicon-glyphicon-user"></span>Register</a></li>
                <li><a href="#"><span class="glyphicon-glyphicon-log-in"></span>Login</a></li>
            </ul>
        </nav>
  • In the above code snippet we have defined the navbar-right, we have value of class attribute as navbar-inverse in the nav element and we have the div with class attribute value  navbar-header to create the navbar in the header 
  • In the navbar header we have the class attribute value navbar-brand to increase the size of the value Techfunda in the anchor <a> tag
  • In the next line we have class attribute value navbar-nav in the ul elements with list values
  • In the last step we are having class attribute value nav navbar-navnavbar-right in the ul elements which creates the list values in the right side of the navbar

output

 

 Views: 511 | Post Order: 35



Write for us