I am preparing to update my site to Bootstrap 3, but I can’t figure out how to replace the nav-list class from Bootstrap 2.
I looked into list groups, but I am not sure if this is to be used to replace nav lists. How would I make the below markup work in Bootstrap 3?
<div class="well"> <ul class="nav nav-list"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> </ul> </div> This is the look I am going for: http://jsfiddle.net/bplumb/2Nguy/
Navigation available in Bootstrap share general markup and styles, from the base . nav class to the active and disabled states. Swap modifier classes to switch between each style. The base . nav component is built with flexbox and provide a strong foundation for building all types of navigation components.
To set the active class to the navigation menu dynamically by scrolling or clicking on the navigation links, the active class is to be set on each section depending on the position of the webpage. To add methods and variables, JavaScript is used.
To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a . tab-pane class with a unique ID for every tab and wrap them inside a <div> element with class . tab-content .
The removal of .nav-list has been documented in Migrating to v3.x – What’s removed:
Nav lists
.nav-list.nav-header
No direct equivalent, but list groups and.panel-groups are similar.
I found this change listed in the changelog inside the “WIP: Bootstrap 3” pull request:
- Remove
.nav-listoption. Replaced by the new.list-groupcomponent.
So if I translate your code to use .list-group instead, I get this:
<div class="well"> <ul class="list-group"> <li class="list-group-item"><a href="#">Link 1</a></li> <li class="list-group-item"><a href="#">Link 2</a></li> </ul> </div> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc2/css/bootstrap.min.css" rel="stylesheet"/> <div class="well"> <ul class="list-group"> <li class="list-group-item"><a href="#">Link 1</a></li> <li class="list-group-item"><a href="#">Link 2</a></li> </ul> </div> However, this does not look identical to the way it did in Bootstrap 2. As I noted in this answer’s comments, there seems to be no exact .nav-list equivalent built-in to Bootstrap 3. So if you need features that .list-group doesn’t have, you will have to write the CSS yourself, or try to port it from Bootstrap 2.
I used class="nav nav-pills nav-stacked" and for me it's a better styled replacement. But perhaps it is resolved in version 3.0.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With