Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a table with switching tab content?

Tags:

html

I want to make a table looks like this: enter image description here

The inside table is not an issue but don't know how to create the outer frame which includes "Item Descriptions", "Shipping", and "Returns" tabs. A minimal example would be greatly appreciated. Thank you.

like image 694
Chan Avatar asked Aug 18 '11 21:08

Chan


People also ask

How do I make tabs display different content?

Approach: In the body tag create some tabs under the div tag with a Custom-Data-Attribute that holds the id of the content. Create another div tag to store the content of the tab with a specific id. Specify data attributes for each content tag to display only one tab content at a time.

How do I create a dynamic tab in HTML?

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 .

How do you make a nested tab in HTML?

To create nested tabs, you can create a new tab group, then click the button "Add HTML Code" and add the shortcode of another tab group.


1 Answers

You could certainly use jQuery to solve this. That's what I did when I needed some tabs. I did something like:

<ul>
   <li><a href="#tab-description">Description</a></li>
   <li><a href="#tab-shipping">Shipping</a></li>
   <li><a href="#tab-returns">Returns</a></li>
</ul>
<div id="tab-description" class="mytabs">
</div>
<div id="tab-shipping" class="mytabs">
</div>
<div id="tab-returns" class="mytabs">
</div>

and then some jQuery to make the tabs:

<script language="javascript" type="text/javascript">
   $(document).ready(function () {
      $("#mytabs").tabs({ fx: {opacity: 'toggle'} });
   });
</script>

works pretty nicely for me. Just fill in whatever your content is in each of the divs.

like image 58
itsmatt Avatar answered Nov 15 '22 12:11

itsmatt