Home arrow Style Sheets arrow Page 3 - 3D Tabs with CSS2
STYLE SHEETS

3D Tabs with CSS2


I hope you had a chance to enjoy my first article on created a tabbed navigation structure with nothing but pure Cascading Styles. With this article we'll move beyond the basics, evolve from the flat colored boxes and lines to nice, rounded 3D looking tabs. This article will provide instructions on creating the images in FireWorks, slicing them correctly, and fitting them into our tab scheme.

Author Info:
By: Justin Cook
Rating: 4 stars4 stars4 stars4 stars4 stars / 11
August 17, 2004
TABLE OF CONTENTS:
  1. · 3D Tabs with CSS2
  2. · The Images
  3. · The Code
  4. · The Style
  5. · Conclusion and All the Code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
3D Tabs with CSS2 - The Code
(Page 3 of 5 )

The Code

For the most part, I'm going to use the same code I did for the CSS tabs. I will only make note of where the changes are. If you need an explanation of anything not noted, it's most likely in the previous article.

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

<div id="everything">

So this time I'm wrapping everything in one div, appropriately named 'everything'. This is so that I can set it to the same width as the image we created, and all the child nodes to inherit the width, without having to set them individually.

<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=""" & theClass & "_l.png"" />")

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

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

Response.Write("<img src=""" & theClass & "_r.png"" /></div>" & vbCrLf)

next
%>

This time you'll notice a couple extra items. I inserted the images into each tab, on the left and right. I also added in two divs below. One is for the bottom corners, and the actionPanel is the main panel, where we'll tile the center slice, and where you'll put all the elements and functional pieces of the page.

</div>
<div id="actionPanel">stuff to do</div>
<div id="btm"></div>
</div>


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials