Previous Message
Next Message

Keeping a "current state" on navigation.

Sent by Chris Heilmann on 29 July 2004 16:04


> On 29/07/2004, Chris Heilmann wrote:
>> As with _any_ ALA article, make sure to read the discussion about it,
>> too.
>> This example especially is really bad PHP coding style... But hey, this
>> is
>> CSS-D, let's take this topic off-line unless someone _does_ know a
>> CSS-only solution.
>
> Someone actually suggested a CSS solution on the ALA article that I've
> used to good effect elsewhere. Basically on each of your pages you
> define an id attribute on the body tag of that page that defines what
> page it is. You can then use standard descendant selectors to
> highlight the current state:
>
> <body id="intro">
>
> <ul id='mainmenu'>
> <li class="menuintro">Intro</li>
> <li class="menucurriculum">Curriculum</li>
> <li class="menuportfolio">Portfolio</li>
> <li class="menuprojets">Projets</li>
> <li class="menucontact">Contact</li>
> </ul>
>
> </body>
>
> #intro .menuintro { your "current/active" style goes here }
>
> Simple to use, CSS only.

And already mentioned earlier in this thread, only the hicksdesign example
with IDs. The cool thing about this solution is that you can define
several highlight states. The thing that makes it less of a "wow" effect
is that you still have to add the body ID by hand. You might as well put
the class in the navigation then...

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: