daydreamer
daydreamer

Reputation: 91959

Twitter Bootstrap 3: How to get vertical navbar?

Seems like it was supported in v2.3.2 in form of class .nav-stacked

<ul class="nav nav-tabs nav-stacked">
  ...
</ul>

Is there a way to do that in version 3.0.0?

Upvotes: 4

Views: 22953

Answers (2)

omma2289
omma2289

Reputation: 54629

The default nav class in Bootstrap 3 has a vertical layout (no borders though), also .nav-pills still support the stackable layout, but if you want the "old" look you can always just add the styles from the previous version to your CSS (plus a small fix):

.nav-stacked > li {
  float: none;
}
.nav-stacked > li > a {
  margin-right: 0;
}
.nav-tabs.nav-stacked {
  border-bottom: 0;
}
/*Fix to remove space between li's*/
.nav-tabs.nav-stacked>li+li {
    margin-top: 0;
}
.nav-tabs.nav-stacked > li > a {
  border: 1px solid #ddd;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
}
.nav-tabs.nav-stacked > li:first-child > a {
  -webkit-border-top-right-radius: 4px;
  -moz-border-radius-topright: 4px;
  border-top-right-radius: 4px;
  -webkit-border-top-left-radius: 4px;
  -moz-border-radius-topleft: 4px;
  border-top-left-radius: 4px;
}
.nav-tabs.nav-stacked > li:last-child > a {
  -webkit-border-bottom-right-radius: 4px;
  -moz-border-radius-bottomright: 4px;
  border-bottom-right-radius: 4px;
  -webkit-border-bottom-left-radius: 4px;
  -moz-border-radius-bottomleft: 4px;
  border-bottom-left-radius: 4px;
}
.nav-tabs.nav-stacked > li > a:hover,
.nav-tabs.nav-stacked > li > a:focus {
  border-color: #ddd;
  z-index: 2;
}

Upvotes: 5

oezi
oezi

Reputation: 51797

bootstrap 3.0 still contains a nav-stacked-class. if it's mising in your copy, just get the latest version or add this to your css-file:

.nav-stacked > li {
  float: none;
}

.nav-stacked > li + li {
  margin-top: 2px;
  margin-left: 0;
}

Upvotes: 0

Related Questions