Style Sheets
  Home arrow Style Sheets arrow Page 2 - 3D Tabs 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

3D Tabs with CSS2
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2004-08-17

    Table of Contents:
  • 3D Tabs with CSS2
  • The Images
  • The Code
  • 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


    3D Tabs with CSS2 - The Images


    (Page 2 of 5 )

    The Images

    We're going to do this all with one image then slice it up. So let's give ourselves plenty of space to work with. Create a new image with a width of at least 900px. This will be the end width of the entire work space on the web page as well, so take into consideration how many tabs you'll have, and how much space you'll need.

    Step 1 – Create the Rounded Rectangles

    So now we have an empty workspace. Grab the rounded rectangle tool. If you don't see it, click and hold the rectangle tool, and it will appear as an option to switch to.

    Draw a big (preferrably white) rounded rectangle, the full width of the image. It doesn't matter too much the height of it, as you'll be tiling the center portion to stretch to whatever length the page needs. Just leave a little space at the top for the two different tabs. Duplicate this layer into another, and hide that layer. (This step is important, and we'll come back to it later.)

    On the same layer, draw a small rounded rectangle that runs into the top of the big one. This is the first tab, the 'on' or active tab. Group these two rectangles with 'Ctrl + g'.

    Now create another layer, behind the first, and draw one more rounded rectangle. This one should be approximately the same size as the first, but a few pixels higher. Do not group this one.

    You should now have something that looks like the following:

    3D Tabs with CSS2

    Step 2 – The 3-Dimensionalization

    Now we want to make them look like buttons or protruted tabs. To do this we can use the Eye-Candy 'bevel boss' filter that comes with FireWorks. Bevel the grouped rectangles first. Then unhide that duplicate layer you created, bevel it so it's the same as the big rectangle, and then re-hide it. Then bevel that other rectangle, the 'off' tab that's sitting behind the group, and do it slightly darker than the others.

    Now the image should look like this:

    3D Tabs with CSS2

    Step 3 – Slicing and Dicing

    Now we need to create the slices to export the pieces we need. To create slices, we use the selection tool, select the area we want, right-click and select 'Insert Slice”.

    So let's get the three general slices for the main panel (top, middle, bottom), then worry about the tabs. This is where that second, hidden layer comes in handy. Unhide it, and hide the layer with the tabs. Create three slices, one with the bottom corners, one thin one of the center, and one that capture the top corners and empty space. Your image should look like this:

    3D Tabs with CSS2

    Export each of these slices with their respective names: top, middle, and bottom.

    Now let's do the tabs. Re-hide this layer, and we can forget about it now, it won't be used further. Unhide the tab layer. Slice it up so you get a left, center, and right slice of each button. The reason we don't just make each tab one big slice is so that we can tile the center piece, and grow the tab to whatever width is necessary. It should look like this:

    3D Tabs with CSS2

    Export each slice with the following names, from left to right: on_l, on_m, on_r, off_l, off_m, off_r. As you can see, I use the state of the tab (on/off), followed by the postion (left, middle, right). You can use whatever naming scheme works for you, just make sure you update the code and the styles.

    And that's it. We've created, sliced, and exported all the images we need. Now let's get into the code.

    More Style Sheets Articles
    More By Justin Cook


       · I don't mean to be too critical, but what on Earth do you mean that it has been...
       · Is there a working example of this?On page 1 of the article (at...
       · completely agree! If you are going to write such articles (especially on css), then...
       · not testing in non-ie browsers? shame on you. you shouldnt call it an article if you...
       · Hi all,Thanks to a very knowledgable person from another forum (i won't name...
       · As for doing this without javascript, you can remove the onClick for the div and put...
       · This asp code doesn't work if your on a page that is not included in the array. This...
       · i should of read the whole article...sorry
       · First of all, stop calling the author "lazy". The guy has written 12 articles for...
       · The real funny thing is this.... These people are all calling the author lazy, but...
     

    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 1 hosted by Hostway
    Stay green...Green IT