1 reply [Last post]
ngtest
ngtest's picture
User offline. Last seen 1 year 36 weeks ago. Offline
newbie
Timezone: GMT+3
Joined: 2010-09-08
Posts: 1
Points: 2

Hello All,

The following code has some css styles for tabs and I created also images to make the tabs 3d I also used asp code and a line of javascript.

I don't know where the problem is. Maybe in my styles?

Any help would be greatly appreciated.

The output of this code is that the central images of the tabs are stacked one on top of the other instead of the tabs positioned next to each other nicely.

Code and styles:

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

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

.tabl {
position: absolute;
height: 132px;
width: 33px;
left: 0px;
top: 0px;
display:inline;
}

.tabr {
position: absolute;
height: 132px;
width: 26px;
right: 0px;
top: 0px;
display:inline;
}

.tabon, .taboff {
position: relative;
height: 132px;
cursor: hand;
display: inline;
}

.tabon {
background-image: url("on_m.png");
}

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

.tabItem {
position:absolute;
height: 132px;
left: 33px;
top: 40px;
display: inline;
}

#actionPanel {
width: 100%;
height: 70%;
padding: 10px;

background: url("mid.png");
background-repeat: repeat-y;
}

#btm {
height: 57px;
background: url("bottom.png");
}

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

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("<div class=""tabl""><img src=""" & theClass & "_l.png"" /></div>")
 
Response.Write("<div class=""tabItem""><img src=""" & arTabs(i) & ".png"" align=""absmiddle"" />")
 
Response.Write("</div>")
 
Response.Write("<div class=""tabr""><img src=""" & theClass & "_r.png"" /></div></div>") 
next

admin

Many thanks,

Nikos

Tony
Tony's picture
User offline. Last seen 1 hour 15 min ago. Offline
rank Moderator
Moderator
Timezone: GMT+10
Joined: 2003-03-12
Posts: 3805
Points: 1240

Hey Nikos, can you link to a

Hey Nikos, can you link to a page some of us are really lazy and don't want to recreate the page to see what's going on.
The problem appears to be position:absolute you are positioning things ontop of each other.

Position absolute uses it's parent container that has been positioned to work out where to place things.
It also takes the element out of the flow so the positioned element disregards it's brothers and sisters.
So say you have a family room that is positioned absolutely and you position all the furniture absolutely top:0; left:0; you would be stacking all the furniture in the corner ontop of each other.

Try changing the position values to relative so they consider what is next to them.
You may want to remove the display:inline as well.

Your question may have already been answered, search and read before you ask.