3 replies [Last post]
bgbs
Offline
Enthusiast
Last seen: 9 years 19 weeks ago
Timezone: GMT-6
Joined: 2007-08-29
Posts: 102
Points: 52

My site is designed in php
I use include header.php which contains the navigation menu
What I would like to do, is when I click on a link, that link becomes highlighted and "current"

Here is how it is setup.

  • Home
  • About us
  • Our Mission
  • Our Clients
  • Gallery
  • Contact us
  • Services
  • Is it possible to do that when header is included, or to make a certain class current I need diffirent header everytime?

    Thanks

    Tony
    Tony's picture
    Offline
    Moderator
    Brisbane
    Last seen: 2 weeks 1 day ago
    Brisbane
    Timezone: GMT+10
    Joined: 2003-03-12
    Posts: 5344
    Points: 2965

    body id

    Hi bgbs,
    use php to give the body element a unique id for each page.

    ...

  • Home

  • About us

  • Our Mission


  • then you can use the body id to target the correct LI.

    li{background:green;}
    #home .home, #about .about, #mission .mission, {background:red;}

    bgbs
    Offline
    Enthusiast
    Last seen: 9 years 19 weeks ago
    Timezone: GMT-6
    Joined: 2007-08-29
    Posts: 102
    Points: 52

    Cool, Thanks. That seems

    Cool, Thanks.
    That seems easy enough

    Katie
    Katie's picture
    Offline
    Enthusiast
    Seattle, WA
    Last seen: 6 years 12 weeks ago
    Seattle, WA
    Timezone: GMT-8
    Joined: 2006-08-06
    Posts: 357
    Points: 2

    I love this technique. What

    I love this technique. What a great, succinct description of how to do it, Tony. Smile

    Blog: Pew Pew Laser Blog
    Online File Storage: DropBox
    Daily Deals on Local Activities: Groupon