Style Sheets
  Home arrow Style Sheets arrow Page 3 - Tabbed Browsing with CSS2
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Tabbed Browsing with CSS2
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 17
    2004-07-28

    Table of Contents:
  • Tabbed Browsing with CSS2
  • The Style
  • Conclusion and All the Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Tabbed Browsing with CSS2 - Conclusion and All the Code


    (Page 3 of 3 )

    So you've seen that with a minimal amount of code, you can generate ergonomic, table-less tabs. And we did it all with a very basic array iteration, and a bit of CSS. This will no doubt increase the usability of your application ten-fold.

    There is a chance that you're not quite satisfied with the flat-looking tabs, despite their advantages of easy configuration and fast loading. That's probably because you've seen tabs out there that look quite fancy, employing the use of 3D-looking buttons (like www.no-ip.com). Well, if you're interested in graduating to the next level of tabbing, stay tuned for my next article, which will explain how to create the 3D tabs in FireWorks, slice them up, and apply them to your tab structure in an extremely flexible and manageable way.

    But until then, have fun with your new knowledge of table-less tab creation!

    All the Code:

    <style>
    #navTabs {
    font-family: verdana;
    padding: 0px 0px 0px 15px;
    margin: 0px;
    width: 100%;
    height: 30px;
    vertical-align: middle;
    border-color: #333333;
    border-style: solid;
    border-width: 0px 0px 2px 0px;
    }


    .tabon, .taboff {
    height: 30px;
    cursor: pointer;
    cursor: hand;
    display: inline;
    overflow: hidden;
    vertical-align: top;
    font-size: 11px;
    padding: 6px 2px 0px 2px;
    margin: 0px 2px;
    border-color: #333333;
    border-style: solid;
    border-width: 1px 1px 0px 1px;
    }


    .tabOn {
    font-weight: bold;
    position: relative;
    top: 2px;
    background: #ffffff;
    border-width: 2px 2px 0px 2px;
    }


    .taboff {
    color: #666666;
    background: #dddddd;
    }

    </style>

    <%
    dim arTabs( 5 )
    arTabs( 0 ) = "home"
    arTabs( 1 ) = "events"
    arTabs( 2 ) = "news"
    arTabs( 3 ) = "photos"
    arTabs( 4 ) = "users"
    arTabs( 5 ) = "admin"
    %>

    <div id="navTabs">

    <%
    dim theClass, thisPage

    thisPage = Request.ServerVariables("SCRIPT_NAME")
    thisPage = replace( right( thisPage, len( thisPage ) - inStrRev( thisPage, "/" ) ), ".asp", "" )

    for i = 0 to uBound( arTabs)

    if thisPage = arTabs(i) or left( thisPage, len( arTabs(i) ) ) = arTabs(i)

    then
    theClass = "on"

    else
    theClass = "off"

    end if

    response.Write("<div class=""tab" & theClass & """ onclick=""javascript:window.location='" & arTabs(i) & ".asp'"">")

    Response.Write("<img src=""" & arTabs(i) & ".gif"" align=""absmiddle"" />&nbsp;")

    Response.Write( replace( arTabs(i), "_", " " ) & "</div>" & vbCrLf )

    next

    %>
    </div>


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Here is the PHP verison of the original ASP code. Note, this version is just as...
       · <?php $arTabs[] = array(); $arTabs[0] = "msds"; $arTabs[1] = "diagrams"; ...
       · The tabs don't display too well in firefox (v0.9). Any idea of a fix?
       · This doesn't work on Safari,IE5 and Firefox 0.8 on Mac OS X
       · The php section should be like this:<?php $arTabs[] = array(); $arTabs[0] =...
       · yes, that is a more efficient way of using basename...shoulda looked it up...the css...
       · This also doesn't work in Mozilla 1.7.1.Has anyone found any solutions to...
       · I have found a solution all, thanks to teh excellent Paul O'Brian. Include the...
       · $thisPage = basename($_SERVER[PHP_SELF], ".php");This line works nicely too. And...
       · Please help. Thanks.
       · How useful, please help you with what? Your hairstyle? Your failed social life?
       · where will i put <a href=""> on every tab...??tnx..
       · You do not use href as the javascript takes care of switching...
     

    STYLE SHEETS ARTICLES

    - Improving the Visual Presentation of a CSS D...
    - Fixing Browser Incompatibilities in a CSS Dr...
    - Building Clean Drop-Down Menus with CSS
    - Creating Hybrid Web Page Layouts with Negati...
    - Creating Three-Column Web Page Layous with N...
    - Swapping Column Positions in Web Page Layout...
    - Creating Web Page Layouts with Negative Marg...
    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT