How can I display text only on the collapsed navbar in Bootstrap?

css, responsive-design, twitter-bootstrap

Solution

You can control the visibility of your text by CSS, something like this:

.abcde .text {
  display: none;
}
.abcde.collapse .text {
  display: inline-block;
}

Problem

I'd like to display a telephone number that appears on the navbar next to the navbar toggle button. The toggle button only appears once the navbar is in the collapsed state. I'd like the text to appear next to it. Here's what I have now: And here's what I am trying to achieve: HTML from the relevant divs: ``` <div class="header-centered"><img src="http://placehold.it/350x150"></div> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <!-- .btn-navbar is used as the toggle for collapsed navbar content --> <button type="button" 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> </button> <!-- Everything you want hidden at 940px or less, place within here --> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Link1</a></li> <li><a href="#">Link2</a></li> <li><a href="#">Link3</a></li> <li><a href="#">Link4</a></li> <li><a href="#">Link5</a></li> </ul> </div> </div> </div> </div> ``` I don't want the text to appear unless the navbar is collapsed. How can this be achieved?

Original source