html - How to put align a link right side in navigation bar -
i have following code, want align logout button right hand side , 3 modules (contact us, epm , modules) @ center, how can of bootstrap.thanks in advance.
<div class="container-fluid"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="home.jsp" style="color:purple;cursor: auto" id="wel">welcome admin</span></a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="about_epm.jsp">about epm</a></li> <li><a href="contact_us.jsp">contact us</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">modules <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">employer section</a></li> <li class="divider"></li> <li><a href="#">employee section</a></li> <li class="divider"></li> <li><a href="#">client section</a></li> <li class="divider"></li> <li><a href="#">project details</a></li> </ul> </li> <li> <a onclick="logout();" class="navbar-brand pull-right"> <span class="glyphicon glyphicon-off" id="icon"> logout</span> </a> </li> </ul> </div> </div>
to right align logout object, can use bootstrap's navbar-right
class.
to center align other links can use following css:
#bs-example-navbar-collapse-1 { text-align:center; } .centered-navbar { display:inline-block; float:none; vertical-align:top; }
html
<nav class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <!-- brand , toggle grouped better mobile display --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="home.jsp" style="color:purple;cursor: auto" id="wel">welcome admin</a> </div> <ul class="nav navbar-nav centered-navbar"> <li class="active"><a href="about_epm.jsp">about epm</a></li> <li><a href="contact_us.jsp">contact us</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">modules <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">employer section</a></li> <li class="divider"></li> <li><a href="#">employee section</a></li> <li class="divider"></li> <li><a href="#">client section</a></li> <li class="divider"></li> <li><a href="#">project details</a></li> </ul> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li> <a onclick="logout();"> <span class="glyphicon glyphicon-off" id="icon"> logout</span> </a> </li> </ul> </div> </div> </nav>
bootply here: http://www.bootply.com/ddmugfx0pi
Comments
Post a Comment