5 replies [Last post]
Smee
Smee's picture
Offline
Elder
Adelaide, Oz
Last seen: 2 years 41 weeks ago
Adelaide, Oz
Timezone: GMT+9.5
Joined: 2007-06-10
Posts: 1596
Points: 340

Well it's foxed me again Sad

I would like the background red button stay on Practitioners and the sub menu items stay red when active...for instance when you click "guidelines" ON THIS PAGE

I've tried all sorts of LIs and current but not struck the magic combination yet Shy
Both CSS and HTML validated.

Thanks

Mods and gurus – THANK YOU!
For your time, knowledge and experience so willingly and generously given.
Please come back tomorrow and sort us all out again Smile

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 1 day ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Hi Smee, If you want the the

Hi Smee,
If you want the the top item to be the same on hover, use hover in the selector as well.
.current, .current:hover{

This how to should help with the rest: CSS current page nav link highlight

Smee
Smee's picture
Offline
Elder
Adelaide, Oz
Last seen: 2 years 41 weeks ago
Adelaide, Oz
Timezone: GMT+9.5
Joined: 2007-06-10
Posts: 1596
Points: 340

Hi Tony Thanks for this, the

Hi Tony Smile Thanks for this, the information will definitely come in handy and I knew that post of Hugo's was around somewhere...I searched for it for ages a couple of weeks ago but couldn't get it to come up for me.

However, despite all that I'm not sure that you understood what I was after...or probably I didn't explain it well enough. As the page currently stands the red background is on Practitioners and when you hover over Guidelines the text will go red.

I want it so that when I click Guidelines, the text stays red (as active page) and the background stays put on Practitioners - currently the background moves to Guidelines when it's clicked. Puzzled

Thanks again

Mods and gurus – THANK YOU!
For your time, knowledge and experience so willingly and generously given.
Please come back tomorrow and sort us all out again Smile

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 23 hours 4 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9754
Points: 3836

Hi Ducky, You have 7 top

Hi Ducky,

You have 7 top level menu items and for the first two, at least, 11 sub items each. So as it stands, you need to uniquely identify 29 items, at the page level, so they can be addressed.

How are you setting the "current" class token on the proper menu item now? Can you not use the same method to add it to both the top menu item and the current sub-item?

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Smee
Smee's picture
Offline
Elder
Adelaide, Oz
Last seen: 2 years 41 weeks ago
Adelaide, Oz
Timezone: GMT+9.5
Joined: 2007-06-10
Posts: 1596
Points: 340

.

Hi Gary *waving*
(do duckys wave? well this one seems to - must change the avatar again)

I've got a .current class.
I think that was roughly the conclusion I came to reading Hugo's missive again. So if I give each page a Body ID and then specify a .sub-menu class I should be able to target it - is that the idea?

So that means I have to specify every sub-menu item in the css a la

#practitioners .guidelines .management .etc .etc { background: none; color: red; )
#patients .fact .allied .etc .etc { background: none; color: red; )

...not sure that'll work for
<li><a  class="guidelines" href="guidelines.php">Guidelines</a></li>

Or else... thinking on the fly here...
#practitioners .current-sub-item { background: none; color: red; )
then on the active sub menu item it would be
<li><a  class="current-sub-item" href="guidelines.php">Guidelines</a></li>
Since I haven't reset .current which has the red bg button...no it won't carry it to another page - or will it?
...I think I'm missing something and I haven't time to think it further as unfortunately I'm on my way out and won't be able to try this until much later this afternoon.

ETA: or do I have this as well...
<li><a class="current" href="practitioners.php">Practitioners</a>
Will that work?

Mods and gurus – THANK YOU!
For your time, knowledge and experience so willingly and generously given.
Please come back tomorrow and sort us all out again Smile

Smee
Smee's picture
Offline
Elder
Adelaide, Oz
Last seen: 2 years 41 weeks ago
Adelaide, Oz
Timezone: GMT+9.5
Joined: 2007-06-10
Posts: 1596
Points: 340

Well...

...it was really simple in the end.

I left .current on the major menu item and added .sub-menu-current to the relevant item requiring no background button but red text instead. Didn't need a page ID either.

I think I was over thinking it or that for some reason I couldn't have two classes in the same menu.

Thanks for the help Smile

Mods and gurus – THANK YOU!
For your time, knowledge and experience so willingly and generously given.
Please come back tomorrow and sort us all out again Smile