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!
<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"" /> ")
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. |