Pesky LI Navigation links when using Master Pages
Hi again
I've been working through a problem that has been bugging me for a while now. But I've just never had the time to work out a solution.
Think of it this way ...
I have an awesome navigation menu that uses
The answer I have found is to simply use CSS selectors to set the style.
Let's say we have the following pages:
- Home
- Blog
- Contact
- About
What we need to do is, give the body tag on each page a unique ID. For example
would be set on the Home page.Now each of the
<li id="homenav">home</li>
would be the nav element to get us back Home again. Do the same for each of the other nav elements.
To tie it all together, add these lines to your CSS file to set the style, dependent on the page you are currently looking at:
<#home #homenav {background-image: url(homenav-sizzle.jpg);}
What happens is that the cascading nature of the two elements forms a unique style selector which lets you customise it without affecting any other pages in your site.
Just remember to make sure the IDs you use are unique. That is the key.
Until next time ....