twitter bootstrap and profile/avatar image in navbar

jsp, jstl, twitter-bootstrap

Solution

Heres what I was able to do for the username place in the navbar

HTML

<div class="pull-right navbar-text">
  <img src="http://placehold.it/30x30">
  Chuck Norris
</div>

CSS

.navbar-text img {
  max-height:30px;
  width:auto;
  vertical-align:middle;
}

Problem

I am using Twitter Bootstrap and I am trying to get the user's profile pic to come across next to their username in the navbar. Here is my code. But what happens is the picture ends up flush to the top of the screen. I didn't know if there was a way with the twitter bootstrap css to get it to center. Any suggestions would be greatly appreciated. ``` <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="#">Codename: Success</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li class="nav-header">Nav header</li> <li><a href="#">Separated link</a></li> <li><a href="#">One more separated link</a></li> </ul> </li> </ul> </div> <c:choose> <c:when test="${not empty pageContext.request.userPrincipal.name}"> <div id="userHeaderProfile" class="navbar-text pull-right"> <p>${pageContext.request.userPrincipal.name}</p> </div> <div class="pull-right"><img src="http://placehold.it/30x30" alt="30x30" /></div> </c:when> <c:otherwise> <form method="post" class="navbar-form pull-right" action="<c:url value='/j_spring_security_check'/>"> <input id="username" name="j_username" class="span2" type="text" placeholder="Email"> <input id="password" name="j_password" class="span2" type="password" placeholder="Password"> <button type="submit" class="btn">Sign in</button> </form> </c:otherwise> </c:choose> <!--/.nav-collapse --> </div> </div> </div> ```

Original source