Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Css Menu: Different Styling On Selected Items

This is a discussion on Css Menu: Different Styling On Selected Items, within the CSS section. This forum and the thread "Css Menu: Different Styling On Selected Items" are both part of the Designing Your Website category.

 
Reply to this topicStart new topic
> Css Menu: Different Styling On Selected Items
HitByLife
post May 15 2008, 09:23 AM
Post #1


Fresh Squeezed
**

Group: Members
Posts: 15
Joined: 4-March 08
Member No.: 191



I planned to post a lot more here when I signed up but there's just no time for it all. Work gets the best of me, I'm afraid. Anyway, I just popped in to check whether any of you have any good ideas on how to achieve the following: keep items selected when you move down in a menu hierarchy so that one can follow a path, from a top level to sub levels.

Here's a pic that I hope illustrate the idea:



When moving down in the menu, the corresponding levels further up in the hierarchy remain selected so that the person navigating will remember the path, or know where in the system he is. It may seem a bit awkward to do it this way, but that's how the client wants it. No drop-downs or fly-outs.

I have tried with "current" and "a:focus" but it doesn't really work out; the items do not remain selected.

Not sure if I have explained this adequately, but if someone did get it, I'd appreciate a few notes.
Go to the top of the page
 
+Quote Post
Linda
post May 15 2008, 09:33 AM
Post #2


Co-Founder
*******

Group: Co-Founders
Posts: 2,769
Joined: 13-February 08
From: Pink House in USA
Member No.: 3



I personally don't know how to do it, but this menu http://www.cssplay.co.uk/menus/pro_droptab.html#nogo
might be helpful. It appears to be similar in it's action as what you are hoping to do. See if this sheds any light on the the problem.


--------------------
Go to the top of the page
 
+Quote Post
HitByLife
post May 15 2008, 09:57 AM
Post #3


Fresh Squeezed
**

Group: Members
Posts: 15
Joined: 4-March 08
Member No.: 191



QUOTE (Linda @ May 15 2008, 10:33 AM) *
I personally don't know how to do it, but this menu http://www.cssplay.co.uk/menus/pro_droptab.html#nogo
might be helpful. It appears to be similar in it's action as what you are hoping to do. See if this sheds any light on the the problem.


No, not quite, but thanks anyway.
Go to the top of the page
 
+Quote Post
MikeHopley
post May 16 2008, 05:51 AM
Post #4


Squeeze Machine
*****

Group: Mentor
Posts: 602
Joined: 15-February 08
From: UK
Member No.: 143



Multi-level navbars. Yuck. Well, at least it's not a drop-down.

Anyway, I think CSS is probably not strong enough to do this on its own. With some PHP, however, it should be straightforward.

The idea would be to use PHP to test each link, and see whether it matched the corresponding part of your URL path. If they match, you use PHP to apply a class to the link, which CSS then styles.

If you keep your site structure (naming of URLs) absolutely consistent, then the script should be able to do this automatically. Otherwise, you'll have to test on a case-by-case basis, which is miserable.

This post has been edited by MikeHopley: May 16 2008, 06:01 AM
Go to the top of the page
 
+Quote Post
HitByLife
post May 19 2008, 03:30 AM
Post #5


Fresh Squeezed
**

Group: Members
Posts: 15
Joined: 4-March 08
Member No.: 191



QUOTE (MikeHopley @ May 16 2008, 05:51 AM) *
Multi-level navbars. Yuck. Well, at least it's not a drop-down.

Anyway, I think CSS is probably not strong enough to do this on its own. With some PHP, however, it should be straightforward.

The idea would be to use PHP to test each link, and see whether it matched the corresponding part of your URL path. If they match, you use PHP to apply a class to the link, which CSS then styles.

If you keep your site structure (naming of URLs) absolutely consistent, then the script should be able to do this automatically. Otherwise, you'll have to test on a case-by-case basis, which is miserable.


Hi Mike, yep, php took care of it. The programmer sorted the code out and I only made sure "current" was applied correctly (sometimes it's easy to confuse "class" and "id").
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   6 karinne 298 20th February 2008 - 06:52 PM
Last post by: Stuart
No New Posts   5 Mark 249 27th February 2008 - 04:07 PM
Last post by: delusion
No New Posts   5 Jason 166 23rd March 2008 - 11:07 AM
Last post by: Ryan
No new   18 Itsumishi 495 12th May 2008 - 01:58 AM
Last post by: Itsumishi
No New Posts   8 unitedcraig 231 4th April 2008 - 09:50 AM
Last post by: Marc