Advertisement:

Site Menu Help

Aloittaja eleven0, helmikuu 07, 2008, 11:41:07 IP

« edellinen - seuraava »

eleven0

I recently got SMF layers system working on my site. I'm putting up a master menu. But i got a problem with something.

Active tab is not working.

I got this for my menu;
<div  id="menu">
<ul>
<li id="current"><a href="index2.php">Home</a></li>
<li><a href="index.php">Forums</a></li>
<li><a href="index3.php">Download</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Other</a></li>
</ul>
</div>


here i got this in CSS;

#menu {
clear: both;
margin: 0; padding: 0 40px 0 0;
font:12px/26px Tahoma, Sans-serif;
text-transform: uppercase;
height: 26px;
}
#menu ul {
float: left;
list-style: none;
margin:0; padding: 0;
}
#menu ul li {
display: inline;
}
#menu ul li a {
display: block;
float: left;
padding: 0 8px;
color: black;
text-decoration: none;
}
#menu ul li a:hover {
background-color: #666;
color: #cccccc;
}
#menu ul li#current a {
background-color: #474A41;
color: #333;
}


When you click on on another page, it would still show it like you are on "Home" page.

Thanks for any help.

ciberwing

Your xhtml and css code are right...

Now, look if when you change of active link, in the source, change the id of the li element...

Another way is to define a body id for each section of your web... with some php code...
and then, in the css, you do something like this:


body#home ul#menu li a {}
body#home ul#menu li#active a {}
body#forum ul#menu li a {}
body#forum ul#menu li#active a {}


ect...


[nofollow]Links:
SMF-Spoiler-Tag

eleven0

I think CSS fits better. I'm only going to have 5 pages maybe more. So i should be able to get this done with CSS.

So can someone tell me why this is not working for me?

CmptrWz

Your <li id="current"> part is the problem. You need to have that id="current" move around.

Advertisement: