Search code examples
tabszurb-foundation-5

Zurb Foundation's tab in quadrant layout


I would like to use this code I found from Zurb Foundation documentation. Unfortunately, the tabs are laid out horizontally. I need them like this - enter image description here

Here is the tab code from Zurb Foundation and the link to it as well

http://foundation.zurb.com/docs/components/tabs.html#tabs-deeplink-2

<ul class="tabs" data-tab role="tablist">
  <li class="tab-title active" role="presentational" ><a href="#panel2-1" role="tab" tabindex="0" aria-selected="true" controls="panel2-1">Tab 1</a></li>
  <li class="tab-title" role="presentational" ><a href="#panel2-2" role="tab" tabindex="0"aria-selected="false" controls="panel2-2">Tab 2</a></li>
  <li class="tab-title" role="presentational"><a href="#panel2-3" role="tab" tabindex="0" aria-selected="false" controls="panel2-3">Tab 3</a></li>
  <li class="tab-title" role="presentational" ><a href="#panel2-4" role="tab" tabindex="0" aria-selected="false" controls="panel2-4">Tab 4</a></li>
</ul>
<div class="tabs-content">
  <section role="tabpanel" aria-hidden="false" class="content active" id="panel2-1">
    <h2>First panel content goes here...</h2>
  </section>
  <section role="tabpanel" aria-hidden="true" class="content" id="panel2-2">
    <h2>Second panel content goes here...</h2>
  </section>
  <section role="tabpanel" aria-hidden="true" class="content" id="panel2-3">
    <h2>Third panel content goes here...</h2>
  </section>
  <section role="tabpanel" aria-hidden="true" class="content" id="panel2-4">
    <h2>Fourth panel content goes here...</h2>
  </section>
</div>


Solution

  • If you use a max width on the .tabs it should work just fine.

    .tabs {
      max-width: 300px;
    }
    

    Because the tabs inline and float: left the max-width will constrain them and make them go down vertically.

    Working example: http://codepen.io/nathanw/pen/zxgjrO