Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: eleven0 - helmikuu 07, 2008, 11:41:07 IP

Otsikko: Site Menu Help
Kirjoitti: eleven0 - helmikuu 07, 2008, 11:41:07 IP
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.
Otsikko: Re: Site Menu Help
Kirjoitti: ciberwing - helmikuu 08, 2008, 09:54:12 AP
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...
Otsikko: Re: Site Menu Help
Kirjoitti: eleven0 - helmikuu 08, 2008, 01:06:04 IP
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?
Otsikko: Re: Site Menu Help
Kirjoitti: CmptrWz - helmikuu 09, 2008, 06:07:29 IP
Your <li id="current"> part is the problem. You need to have that id="current" move around.