Page 1 of 1

SOLVED: Problem with navigation menu

Posted: Tue Nov 06, 2012 7:00 pm
by handcoded
Hi

I'm using a free template called handyman and am having a headache with the navigation menu as it renders completely differently in different browsers.

IE - looks fine. Wording evenly spaced and padded
FF - No top or bottom padding
Chrome - Padding good but text aligned to top

I've simplified the template a little but here is what the header should look like
http://blog.templatemonster.com/2011/10 ... intenance/

Some help with this would be gratefully received.

Website uses CMS MS - Isabella.

Re: Problem with navigation menu

Posted: Tue Nov 06, 2012 8:57 pm
by Dr.CSS
As always a link to the problem site is best...

Re: Problem with navigation menu

Posted: Tue Nov 06, 2012 9:30 pm
by handcoded
Problem website is www.handcoded.co.uk/spencer

Re: Problem with navigation menu

Posted: Tue Nov 06, 2012 10:41 pm
by gocreative
Have you tried specifying a height and line-height for the whole menu bar? If they're both set to the same value, this will vertically-align your text. Get rid of any top or bottom padding/margins on the text as well.

Re: Problem with navigation menu

Posted: Tue Nov 06, 2012 11:36 pm
by handcoded
So it turns out that I had some un-ordered list code in my template which was conflicting with the menu and my problem is now resolved.

The last link on the navigation bar should have a class on it called last that curves the right edge.

I've looked at my menu template but cannot work out how I can define a class for the last menu link. Any ideas?

Thanks

Re: Problem with navigation menu

Posted: Tue Nov 06, 2012 11:50 pm
by gocreative
There are several ways:

Option 1
If you want to manually specify which the last link is, you can do the following:

1. Add this code to the LI (or A) in your menu template:

Code: Select all

class="nav-{$page_alias}"
This will output something like <li class="nav-projects">.

2. Create a new CSS class in your stylesheet called "li.nav-projects" and style as required.

Option 2
Automatically apply a "last" class using Smarty. Example here: http://www.i-do-this.com/blog/10/Add-cl ... -menu-item

Option 3
Use CSS and/or jQuery to automatically apply a style to the last child element.

CSS:

Code: Select all

li:last-child { /* your styles */ }
jQuery:

Code: Select all

$("nav ul.menu li:last-child").addClass("last");

Re: Problem with navigation menu

Posted: Wed Nov 07, 2012 12:01 am
by handcoded
Very thorough.

Thanks very much