Question

I am trying to acquire the look and feel of a drop down menu with a mouse click. The html I have so far looks a bit like this

<div id="tabs">
<ul id="tab_list">
    <li><a href="" id="tab1" class="active">Contents</a></li>
    <li><a href="" id="tab1" class="active">Contents</a></li>
    <li><a href="" id="tab1" class="active">Contents</a></li>
</ul>
</div>
<div id="tab_contents">
<div class="">
<h2>The table of contents</h2>
<p>The descriptive text for this tab</p>
</div>
<div class="hide">
<h2>About the author</h2>
</div>
<div class="hide">
<h2>About the downloads</h2>
</div>
</div>

And the css

#tabs{margin-top: 1em;} 
#tab_list{margin: 0;
          padding: 3px 6px;
          border-bottom: 1px solid black;}            
#tab_list li {list-style-type: none;
              display: inline;}               
#tab_list li a {padding: 3px 1em;
                margin-left: 3px;
                text-decoration: none;
                font-weight: bold;
                color: black;
                background: yellow;
                border: 1px solid black;
                border-bottom: none;}                   
#tab_list li a:hover{background: white;
                    border-color: black;}                       
#tab_list li a:active{background-color: white;
                      border-bottom: 1px solid white;}                        
#tab_contents div{padding: 5px 10px 10px;
                  border: 1px solid black;
                  border-top: 0;
                  height: 100px;}                     
.hide {display: none;}

Now i want to hide and show each content page based on the category i choose. How can i acquire this effect? Please, work directly in my example.

Was it helpful?

Solution

If i understood correctly what you want, I'm not sure it can be done without js and why do you have tags with the same id ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top