xvxvsdfsfsdf
sdf sdf sdf
Why would this be cool?First look at the HTML structure: all elements related to one tab are within one block. Now think about that for a while. This must be done by Chris Coyier's Functional CSS Tabs Revisited already, right? Maybe. But then you may notice another thing: Chris' example uses absolute positioning for the content. This means the tabs must be of fixed height. Yet these tabs here certainly aren't! What is this devilry?First of all we are working with inline content here and being smart about it. We eliminate white space using the dirty but sufficient zero font-size. There is one additional element in comparison to what Chris had: As for the The support must be poor!The CSS only part of this solution works in Internet Explorer 9+. All the other browsers are supported from so far back that it is enough to tell this works on Firefox, Chrome, Safari and Opera. The JavaScript is quite simple and it is for IE8 and below. It does no harm to other browsers, but you probably want to hide it behind IE conditional comments: Supporting the oldInternet Explorer 8 and below do not support the required Due to redrawing issues in IE8 we avoid using selectors like + and ~ with it. And this is also the reason we set class to the The most interesting thing with styling in IE8 and below is to keep the input element on the page: if the element is hidden using All IE8- styles are within one media query so it's easy to remove it. It is also easy to remove IE7 and IE6 only styles by following the comments. |
This method gives you dynamic size for both the tabs and the content area. You can make varying height tabs as you can see and it just works. The tabs can be variable width. The content can be variable height (but not variable width, although that wouldn't make sense anyway). With very little JavaScript and some more CSS we get support for IE6+.
<div class="tabs">
<div class="tab">
<input class="tab-radio" type="radio" id="tab-X" name="tab-group-Y" checked>
<label class="tab-label" for="tab-X">TAB TITLE</label>
<div class="tab-panel">
<div class="tab-content">
TAB CONTENT GOES HERE
</div>
</div>
</div>
</div>