7 replies [Last post]
bradanderson
Offline
newbie
Last seen: 14 years 3 weeks ago
Timezone: GMT+9
Joined: 2005-11-25
Posts: 8
Points: 0

Hello again,
I am still working on my list menu and have almost got it figured out. I have some main points (menus), and then subpoints (submenus) underneath them. You can see the css at www.musoshindenryu.com/styles/main.css and the page I'm playing with at http://musoshindenryu.com/about/index.htm

The problem is that when I'm on the main page (in this case the "About" page, the icon (in the menu bar) that is supposed to display the "current" page, always goes to the first submenu item. In this case that is the "Kata" page.

It DOES work correctly when I select one of the submenu pages to view. I'm sure there is a simple sytanx mistake, but for the life of me I can't figure out how to do it.

You can see similar examples under the "Dojo" section as well.
Thanks in advance, for all of your help.

Brad

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 7 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

You know, I really think it

You know, I really think it would make more sense just to add a 'selected' class to your HTML and then style that rather than all this:

#home-page ul#mainnav li#home-link, /*to distinguish the page currently being viewed */ #news-page ul#mainnav li#news-link, #about-page ul#mainnav li#about-link, #kata-page ul#mainnav li#about-link ul li#kata-link, #term-page ul#mainnav li#about-link ul li#term-link, #dojo-page ul#mainnav li#dojo-link, #sensei-page ul#mainnav ul li#sensei-link, #beg-page ul#mainnav ul li#beg-link, #contact-page ul#mainnav li#contact-link, #member-page #member-link, #guide-page li#guide-link, #howto-page li.howto-link, #profile-page ul#mainnav ul.profile-link, #testing-page ul#mainnav ul#testing-link { background: transparent url(/assets/mon-whiteonly.png) no-repeat right; }

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Hi Brad I have taken a

Hi Brad I have taken a further look at this and spent a while working through the logic of the selectors then I think found the real problem, which seems too simple, so will need testing. give this a try:

background: transparent url(/assets/mon-whiteonly.png) no-repeat right top;

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

bradanderson
Offline
newbie
Last seen: 14 years 3 weeks ago
Timezone: GMT+9
Joined: 2005-11-25
Posts: 8
Points: 0

Tyssen, Thank you for taking

Tyssen,
Thank you for taking a look. I know that the css is a mess on this one.

You said to add a "selected" class to the html. I guess I don't understand. Do you mean that for each page, the menu li item for that particular page would have a "selected" class attached to it?

If so, I had considered that, but I originally wanted to keep the menu the same on every page to allow for easy changing and updating if need be.

Did you mean something else?

Thanks again!

bradanderson
Offline
newbie
Last seen: 14 years 3 weeks ago
Timezone: GMT+9
Joined: 2005-11-25
Posts: 8
Points: 0

Hugo, Thank you also for

Hugo,
Thank you also for taking the time to go through the (very confusing) css on this. I DO appreciate it!

That fix does almost seem to simple to be true, but I'll give it a shot tonight when I get home and test it in all the browsers.

Thanks again!

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 7 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

bradanderson wrote:If so, I

bradanderson wrote:
If so, I had considered that, but I originally wanted to keep the menu the same on every page to allow for easy changing and updating if need be.

Well if you were building your site using PHP or server side includes, you'd only need to create the code for your menu once which would then be linked to every page and then use scripting to insert 'selected' in the HTML depending on which page you're on. But perhaps that's beyond the capabilities of you/your server at the moment?

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

bradanderson
Offline
newbie
Last seen: 14 years 3 weeks ago
Timezone: GMT+9
Joined: 2005-11-25
Posts: 8
Points: 0

Server, no problem. Me,

Server, no problem. Me, beyond my capabilities. Sounds like something to research in the future though. I'm using DW8 and I'm sure there is an easy way within that to do php, but I have no clue where to start.

Hugo, I tried you fix and it worked in IE6. Gosh that was so simple! Thanks again to both of you for your advice.

Maybe when I have a few months of not caring for my toddler, working out, working, etc I'll take a look at php or ssi.

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 36 weeks 4 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

bradanderson wrote:Server,

bradanderson wrote:
Server, no problem. Me, beyond my capabilities. Sounds like something to research in the future though. I'm using DW8 and I'm sure there is an easy way within that to do php, but I have no clue where to start.

Ditching dreamweaver is a start, it will only mangle your code.

You could use simple JS or PHP to manually add a class="selected" to the relevant list item, depending on perhaps a unique body tag?

Verschwindende wrote:
  • CSS doesn't make pies