0

Is there a Bootstrap3 component that simply collapses a menu at a breakpoint without adding a toggle. For example, if I have a horizontal menu that looks like this on desktop

enter image description here

at screen widths below 768px I would like it to simply stack without collapsing into a toggle like this

enter image description here

Any thoughts?

1 Answer 1

1

Remove the collapse button and the navbar-collapse class. From the getbootstrap.com examples, something like this should do the trick:

<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">Project name</a>
    </div>
    <div>
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </div>
  </div>
</div>

You will have to add a media query to make sure that padding is added to the content in mobile display.

I have made a Bootply here where I added the following CSS to make it work:

@media screen and (max-width: 768px) {
  #wrap > .container {
    padding-top:200px;
  }
}

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.