Best way to create Bootstrap 3 Navbar without wrapping text (and no collapse)
css, html, twitter-bootstrap, twitter-bootstrap-3
Solution
http://jsbin.com/elezawA/1/
Here's a fixed version that works great: http://jsbin.com/elezawA/2
body {
padding-top: 50px;
}
.overflow {
position:absolute;
top:0;
left:0;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-top: 0;
color:#ccc;
max-width:90%;
}
.overflow p {color:#ccc;line-height:50px;padding:0 10px;margin:0;display:inline;}
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-header">
<span class="overflow">
<p>
Trying to get this long line of text to not wrap even if too wide for the view to display. Trying to get this long line of text to not wrap even if too wide for the view to display.
</p>
</span>
</div>
<div class="navbar-header pull-right">
<p class="navbar-text">Menu</p>
</div>
</div>
Going to have to fiddle with the percentage on the smaller widths to allow for the menu area. Do a min-width on this one and you'll figure it out. Perhaps add some padding to get it to not cover up. I will see later on today or tomorrow about this.
Problem
I'm trying to create a Navbar with Bootstrap 3 that doesn't collapse or wrap the text. I'd like the text to simply be cut off (or ellipses) instead of wrapping - so the Navbar remains on a single line without expanding vertically. (this Navbar will be used to display the current view location with a single right-aligned menu) Something like this: ``` <div class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-header pull-left"> <p class="navbar-text" style="overflow: hidden; white-space: nowrap;"> Trying to get this long line of text to not wrap even if too wide for the view to display. Trying to get this long line of text to not wrap even if too wide for the view to display. </p> </div> <div class="navbar-header pull-right"> <p class="navbar-text">Menu</p> </div> </div> ``` As shown, I've been fooling with CSS float, overflow, whitespace settings and can't seem to get the right combination. Also, I'm using two navbar-header elements to avoid collapsing, but I'm open to other options if there is a better way. Thanks for the help.