blueblank
blueblank

Reputation: 4904

How to do this with vertically stacked tabs, instead of horizontal?

I have this set of tabs in css:

/*tabs*/
.tabs {
  position: relative;
  min-height: 200px;
  clear: both;
  margin: 25px 0;
}

.tab {
  float: left;
}

.tab label {
  background: #eee;
  padding: 10px;
  margin-left: -1px;
  position: relative;
  left: 1px;
}

.tab [type=radio] {
  display: none;
}

.tab-content {
  position: absolute;
  top: 28px;
  left: 0;
  background: #f7faff;
  right: 0;
  bottom: 0;
  padding: 20px;
  border: 1px solid red;
}

[type=radio]:checked ~ label {
  background: white;
  border-bottom: 1px solid white;
  z-index: 2;
}

[type=radio]:checked ~ label ~ .tab-content {
  z-index: 1;
}

from here: http://css-tricks.com/functional-css-tabs-revisited/

How can I make them stack vertically? Css is not my area of expertise and thought I'd ask here while I toy with what I'm working with at the moment. I'm trying to retain the pure css implementation, but stack the tabs vertically to the left or right.

Upvotes: 0

Views: 1056

Answers (1)

Jared
Jared

Reputation: 12524

The tabs are divs and therefore block level elements and will stack naturally if you remove

.tab {
  float: left;
}

Upvotes: 1

Related Questions