Unfortunately the accepted answer is using html for Bootstrap 2. However, I've come up with several ways to do this using Bootstrap 3. The simplest way to do this is probably using css translate.
.navbar-brand {
transform: translateX(-50%);
left: 50%;
position: absolute;
}
Live Demo:
http://codepen.io/candid/pen/dGPZvR
This method also allows us to use background images for the logo and allows us to include text without having it show up in the display.
HTML:
<a class="navbar-brand text-hide" href="http://disputebills.com">Brand Text</a>
CSS:
.navbar-brand {
background: url(http://disputebills.com/site/uploads/2015/10/dispute.png) center / contain no-repeat;
width: 200px;
transform: translateX(-50%);
left: 50%;
position: absolute;
}
Live Demo: http://codepen.io/candid/pen/NxWoJL
If for some reason you only want to do this on mobile display simply wrap .navbar-brand in a media query...
/* CENTER ON MOBILE ONLY */
@media (max-width: 768px) {
.navbar-brand {
transform: translateX(-50%);
left: 50%;
position: absolute;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…