Adding contents to tabs using this code.HTML CSS -
i'm new html , css , got curious tabs , came across code time before , wondering how add contents in other tabs.
here's code
<style> #content { background-color: #f2f2f2; padding: 20px 10px; overflow: auto; } #tab-container { float: left; margin: 50px 0 0 0; width: 126px; } #tab-container ul { list-style: none; text-align: center; } #tab-container ul li { border-top: 1px solid #666; border-right: 1px solid #666; border-bottom: 1px solid #666; border-left: 8px solid #666; background-color: #ddd; margin: 8px 0; } #tab-container ul li a, #tab-container ul li a:visited { text-decoration: none; color: #666; display: block; padding: 15px 5px; } #tab-container ul li:hover { border-left: 8px solid #333; } #tab-container ul li a:hover { color: #000; } #tab-container ul li.selected { border-right: none; background-color: #fff; border-left: 8px solid #006699; } #main-container { min-height: 400px; margin: 0 0 0 125px; padding: 20px; background-color: #fff; border: 1px solid #888; } </style> <div id="content"> <div id="tab-container"> <ul> <li class="selected"><a href="">tab 1</a></li> <li><a href="">tab 2</a></li> <li><a href="">tab 3</a></li> <li><a href="">tab 4</a></li> </ul> </div> <div id="main-container"> <h1>put content here...</h1> </div> </div
so how add contents other tabs? thanks.
use this, , use bootstrap work can see example here: http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_tabs_dynamic&stacked=h
<ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#home">home</a></li> <li><a data-toggle="tab" href="#menu1">menu 1</a></li> <li><a data-toggle="tab" href="#menu2">menu 2</a></li> </ul> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <h3>home</h3> <p>some content.</p> </div> <div id="menu1" class="tab-pane fade"> <h3>menu 1</h3> <p>some content in menu 1.</p> </div> <div id="menu2" class="tab-pane fade"> <h3>menu 2</h3> <p>some content in menu 2.</p> </div> </div>
Comments
Post a Comment