Navbar styling - Current page link

liunx

Guest
Will CSS allow me to style the link to the current page? Ie if I have five links in the navbar, and the the user has selected one of the links, and is viewing the page of that link, that particular link should be highlighted.

I want something similar to the navbar on
<!-- m --><a class="postlink" href="http://www.alistapart.com">http://www.alistapart.com</a><!-- m -->

My guess is that CSS alone cannot achieve this.

THanks in advance for any help

wastlingerYou can do it with CSS alone, but I'd recommend using php... Like this (<!-- m --><a class="postlink" href="http://bonrouge.com/br.php?page=current">http://bonrouge.com/br.php?page=current</a><!-- m -->).Hi BonRouge,

You have helped me in the past, but probably don't remember, as you very likely have helped many people. Anyway thanks again.

The problem is that I am trying for a entirely CSS solution as the site in question runs on a php application, that I don't have access to (or more to the point, I don't know php). I only control the presentation layer ie CSS.

How would this be possible with CSS? Why not just use CSS?

Thanks again for your helpPaul O'Brien (<!-- m --><a class="postlink" href="http://pmob.co.uk">http://pmob.co.uk</a><!-- m -->) has a good example of this here (<!-- m --><a class="postlink" href="http://www.pmob.co.uk/temp/nav-body.htm">http://www.pmob.co.uk/temp/nav-body.htm</a><!-- m -->). It involves giving the body tag an id (well, in this example, classes are used, but...) and using the cascade to style the appropriate link. Have a look at the code in the example and see if you can use it. If there's anything you don't get, let me know and I'll try to explain.Thanks for that. Makes sense. I just need to get my php to pass id tags. Thanks again for your help.
 
Back
Top