You are here: Re: Change color of links that have a target of the page on which they are found. « HTML « IT news, forums, messages
Re: Change color of links that have a target of the page on which they are found.

Posted by Andy Dingley on 06/21/07 10:37

On 20 Jun, 19:57, Rich Bradshaw <Rich.Brads...@gmail.com> wrote:

> Sorry about the long title -

It did rather confuse me. I thought you'd be talking about links with
only fragment identifiers (i.e. same page) rather than a navigation
menu and a notion of "current selection" on the menu (which doesn't
even need to always be to the same page)

> I have a page with a navbar on. I would
> like like to make it so that the links that link to the page the user
> is on are a different color.

<li class="current" >...</li>

Simple, works beautifully.

> The problem is, that I want to keep the menu in a file so that I can
> server side include it, so I don't want to have to change it manually
> for each page.

Not so easy, but still a well-known problem

<body class="page-foo" >
....
<!-- SSI begins here -->
...
<li class="nav-foo" >...</li>
<li class="nav-bar" >...</li>
<li class="nav-bat" >...</li>
...
<!-- SSI ends here -->
....

And in the CSS,

li.current,
..page-foo .nav-foo,
..page-bar .nav-bar,
..page-bat .nav-bat
{ background-color: red; }

Obviously you tweak the parent element of each page differently, but
that's easy

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация