On Wed, 18 Feb 2009 14:02:07 -0500, Sandy wrote:
> I am working on a site that uses menus that are includes. I have been
> wrestling with a way to highlight the link to the page you are on in the
> included menu. I have a way that works, but it's kind of labour intensive -
> every page needs a unique bit of style in the header. I'm hoping you guys can
> suggest something a bit more global.
>
> Here is the site and the related style sheets.
>
> http://www.cantoraccess.com
> http://www.cantoraccess.com/css/ca.css
> http://www.cantoraccess.com/css/menu.css
> http://www.cantoraccess.com/css/ie6-hacks.css
> http://www.cantoraccess.com/css/ie7-hacks.css
>
[...]
>
> Is there a way to write the style so that it will work without putting a
> style unique to each page in the head of that page? Can CSS compare the href
> to the URL and if they match, highlight the href? If every body tag has a
> unique id and I add a matching id to the link to that page, could I somehow
> get the browsers to compare that?
>

I believe there is a way to add code to SSI includes, IIRC. However,
for a CSS solution, your last method is probably the easiest to implement.
Give each link a unique ID or class, and put a similar ID or the same class
on the BODY tag of each page.

Example:
HTML:
<body class="macros_1">
....
<li class="macros_1"><a href="macros_2008_resna_library_download.shtml"> ...

<li class="macros_2"><a href="macros_2006_csun_quadruple.shtml"> ...

CSS
body.macros_1  li.macros_1  a,
body.macros_2  li.macros_2  a,
body.macros... /* rest of the links */ {
    /* styling for "your are here" link */
}

(You don't really need the tag name qualifier, as
 ".macros_1 .macros_1 a"
will target the same link.

Cordially,
David
--


______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to