[SOLVED] Secondary horizontal CSSMenu ?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

[SOLVED] Secondary horizontal CSSMenu ?

Post by martin42 »

I'm a CSS newbie, updating a site with a horizontal navigation menu, one level deep...

The main template builds its Nav menu like so:

Code: Select all

{menu number_of_levels="1" start_level="1" loadprops=0 template='cssmenu.tpl'}
For one area of the site, we need a second level menu. For that area, the template says:

Code: Select all

{menu number_of_levels="1" start_level="1" loadprops=0 template='cssmenu.tpl'}
<br/>
{menu number_of_levels="1" start_level="2" loadprops=0 template='cssmenu.tpl'}     
This seems to work OK: it gives a sub-menu below the first one.

But it's illegal CSS (the W3C validator fails), because you end up with duplicated DIVs and ULs:

Code: Select all

<div id="menuwrapper">
<ul id="primary-nav">
... top level menu

<div id="menuwrapper">
<ul id="primary-nav">
... second level menu
Is there a cleaner way to get a secondary horizontal menu?

My first thought was to use the {menu} tag only once (i.e. to lose the number_of_levels="1" limitation) so that drop-down menus appeared. But I would like the site to work on touch-screen devices, and it seemed difficult to get both iOS and Android to work reliably with drop-down menus.... And it's fiddly using drop-downs on a smartphone screens anyway.

Longer-term I'd like to try rebuilding the site with the new Simplex theme (included in the current CMS Made Simple default content). But in the meantime, I'd be grateful if anyone can suggest a cleaner way to get a secondary horizontal menu.

Thanks,

- Martin
Last edited by martin42 on Tue Jan 07, 2014 6:32 am, edited 3 times in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1968
Joined: Mon Jan 29, 2007 4:47 pm

Re: Secondary horizontal CSSMenu ?

Post by Jo Morg »

Make a copy of the template and change the id for the second level?
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

Re: Secondary horizontal CSSMenu ?

Post by martin42 »

Tried that earlier - ended up with funny blobs after the menu entries, so I reverted to the previous version. But maybe I mistyped something. I can try it again tomorrow.
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

Re: Secondary horizontal CSSMenu ?

Post by martin42 »

Yep - that's fixed it! Global change in 'vi' is more reliable than editing by hand ;-)

Cheers

- Martin
Post Reply

Return to “Layout and Design (CSS & HTML)”