Reputation: 4523
I'm using Bootstrap 3 in an app dashboard and I'm facing a problem using navbar. I added a dropdown menu that is being shown correctly, but once I resize the window and the navbar is collapsed, it is showed at the left instead that at the right. What can I do to solve it?
Here you can find an screenshot with the problem and what I need, and some code:
<nav class="navbar navbar-default navbar-fixed-top" 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>
<a class="navbar-brand" href="#">Dashboard</a>
</div>
<c:if test="${not empty username}">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown">${username} <span
class="glyphicon glyphicon-user"></span><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<c:url value='/logout' />">Logout</a></li>
</ul></li>
</ul>
</div>
</c:if>
Upvotes: 1
Views: 6411
Reputation: 17324
The navbar
collapses at 768px, so this media query will float your navbar-nav
to the right once the navbar
is collapsed.
CSS
@media (max-width: 768px){
.navbar-nav{
text-align: right;
}
}
Upvotes: 2