html - How do I remove the bottom border of my selected tab -
how can current html/css coding modified such that, once tab selection has been made, bottom border removed?
here's presently looks like: 
here desired outcome: 
here code:
<!doctype html> <html> <head> <title>javascript tabs example</title> <style type="text/css"> ul#tabs { list-style-type: none; margin: 30px 0 0 0; padding: 0 0 0.3em 0; } ul#tabs li { display: inline; } ul#tabs li { color: #42454a; background-color: #dedbde; border: 1px solid #c9c3ba; border-bottom: none; padding: 0.3em; text-decoration: none; } ul#tabs li a:hover { background-color: #f1f0ee; } ul#tabs li a.selected { color: #000; background-color: #fff; font-weight: bold; } div.tabcontent { border: 1px solid #c9c3ba; padding: 0.5em; background-color: #fff; } div.tabcontent.hide { display: none; } #file_content { width: 100%; border: 1px solid red; } #file_content td { padding: 5px; } </style> <script type="text/javascript"> var tablinks = new array(); var contentdivs = new array(); function init() { // grab tab links , content divs page var tablistitems = document.getelementbyid('tabs').childnodes; ( var = 0; < tablistitems.length; i++ ) { if ( tablistitems[i].nodename == "li" ) { var tablink = getfirstchildwithtagname( tablistitems[i], 'a' ); var id = gethash( tablink.getattribute('href') ); tablinks[id] = tablink; contentdivs[id] = document.getelementbyid( id ); } } // assign onclick events tab links, , // highlight first tab var = 0; ( var id in tablinks ) { tablinks[id].onclick = showtab; tablinks[id].onfocus = function() { this.blur() }; if ( == 0 ) tablinks[id].classname = 'selected'; i++; } // hide content divs except first var = 0; ( var id in contentdivs ) { if ( != 0 ) contentdivs[id].classname = 'tabcontent hide'; i++; } } function showtab() { var selectedid = gethash( this.getattribute('href') ); // highlight selected tab, , dim others. // show selected content div, , hide others. ( var id in contentdivs ) { if ( id == selectedid ) { tablinks[id].classname = 'selected'; contentdivs[id].classname = 'tabcontent'; } else { tablinks[id].classname = ''; contentdivs[id].classname = 'tabcontent hide'; } } // stop browser following link return false; } function getfirstchildwithtagname( element, tagname ) { ( var = 0; < element.childnodes.length; i++ ) { if ( element.childnodes[i].nodename == tagname ) return element.childnodes[i]; } } function gethash( url ) { var hashpos = url.lastindexof ( '#' ); return url.substring( hashpos + 1 ); } window.onload = function() { init() } </script> </head> <body> <table id="file_content" cellspacing="0" cellpadding="0"> <tr><td>file content</td></tr> <tr> <td> <ul id="tabs"> <li><a href="#about">about javascript tabs</a></li> <li><a href="#advantages">advantages of tabs</a></li> <li><a href="#usage">using tabs</a></li> </ul> <div class="tabcontent" id="about"> <h2>about javascript tabs</h2> <div> <p>javascript tabs partition web page content tabbed sections. 1 section @ time visible.</p> <p>the code written in such way page degrades gracefully in browsers don't support javascript or css.</p> </div> </div> <div class="tabcontent" id="advantages"> <h2>advantages of tabs</h2> <div> <p>javascript tabs great if web page contains large amount of content.</p> <p>they're things multi-step web forms.</p> </div> </div> <div class="tabcontent" id="usage"> <h2>using tabs</h2> <div> <p>click tab view tab's content. using tabs couldn't easier!</p> </div> </div> </td> </tr> <tr> <td></td> </tr> </table> </body> </html> 
you add border-bottom selected tab cover gray line follows:
ul#tabs li a.selected { color: #000; background-color: #fff; font-weight: bold; border-bottom: 2px solid #fff; }
Comments
Post a Comment