Previous Message
Next Message

RE: [css-d] Smart Navigation in CSS...Possible?

Sent by Scott Schrantz on 11 September 2002 20:08


> -----Original Message-----
> From: Mike Schoaf [EMAIL-REMOVED]]
> 
> Let's say I have some links:
> About Us | Our Services | Contact Us
> 
> Is there a way using only CSS to detect the section or page that the 
> user is on and highlight that navigation link, be it a different link 
> color or background color?

Not directly. At least, not CSS by itself. What you have to do first is give
the highlighted section a special class or id to set it apart from the
others.

<a href="about.html">About Us</a> | 
<a href="services.html" class="highlight">Our Services</a>

If you're using includes, you'll have to use server-side logic (ASP, PHP) to
dynamically add this class in. Otherwise you can hardcode it into each page.

Now, you can use CSS to style that class.

a.highlight {
background-color: #ff0;
color: #c00;
font-size: 1.5em;
}

CSS alone can't do it without that identifier being there.

--
Scott Schrantz
work: www.rci-nv.com
play: www.computer-vet.com
Previous Message
Next Message

Possibly related: