Home arrow Style Sheets arrow Page 5 - 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 - Conclusion and All the Code
(Page 5 of 5 )

The Conclusion

Now there are two important things I feel I must mention. The first is that this has only been tested in Internet Explorer (I know, slap my wrists). It may need a little tweaking of the CSS to get it to display perfectly in Mozilla or Opera. Feel free to post any findings you make in this regard.

You've also probably noted that by doing things this way -- creating one image for the bottom, middle, and top –- we are limiting ourselves to the width of the image. This doesn't work well if you have more tabs than can fit in that width, or just lot's of lateral content. For these situations, you'd want to slice it up even more, and created an expandable center area, and image slices for all corners and edges that can adjust accordingly.

Other than that, you should be able to make great use of (and extend) this structure in your web application. Feel free to suggest any improvements that you've made!

All the code:

<style>

#everything {
  padding: 0px;
  margin: 4px;
  height: 100%;
  min-height: 800px;
  width: 900px;
}

#navTabs {
  padding: 0px 0px 0px 15px;
  margin: 0px;
  width: 100%;
  background: url("top.png") no-repeat top;
  height: 45px;
  vertical-align: top;
}

.tabon, .taboff {
  height: 45px;
  cursor: pointer;
  cursor: hand;
  display: inline;
  overflow: hidden;
  vertical-align: top;
}

.tabOn {
  background-image: url("on_m.png");
  font-weight: bold;
}

.taboff {
  background-image: url("off_m.png");
  color: #666666;
}

.tabItem {
  vertical-align:top;
  height: 45px;
  display:inline;
  font-size: 11px;
  margin: 10px 0px 0px 0px;
}

#actionPanel {
  width: 100%;
  height: 70%;
  padding: 10px;
  background: url("mid.png");
}

#btm {
  height: 16px;
  background: url("bottom.png");
}
</style>

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

<div id="everything">
<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
%>

</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.

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 6 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials