Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:13:45+00:00 2026-05-29T23:13:45+00:00

Good Afternoon, I am having a hard time setting the navigational links to active

  • 0

Good Afternoon,
I am having a hard time setting the navigational links to active state when a user clicks on the link.
I have a header.php file that holds the nav and lavalamp id. The header.php is included on each page. When I click on the “about” page link, the line still remains on its default position which is on the “home” link. I am running this in php if that helps.

Appreciate your help…Thank you.

The header.php consists of the following html:

<div id="nav" class="grid_9 push_3">
<ul class="lavaLamp" id="lavaLampLine">
        <li><a href="index.php">HOME</a></li>
    <li><a href="about.php">ABOUT US</a></li>
    <li><a href="product.php">SUPPORT</a></li>
    <li><a href="blog">OUR BLOG</a></li>
        <li><a href="contact.php">CONTACT US</a></li>
</ul><!-- end menu -->
</div><!-- end nav -->

The css:

/* Styles for the entire LavaLamp menu */

.lavaLamp {
    position: relative;
    height:15px;
    width:421px;
    margin:3px 0;
    padding:80px 0 0 0;
/* overflow: hidden; */
}
/* Force the list to flow horizontally */
.lavaLamp li {
    float:left;
    list-style:none;
}
/* Represents the background of the highlighted menu-item. */
.lavaLamp li.back {
    border-bottom:4px solid #3A7CB8;
    width:9px;
    height:15px;
    top:90px;
    position:absolute;
    z-index:8;
}

.lavaLamp li.back .left {
    border-bottom:4px solid #3A7CB8;
    height:15px;
    overflow:hidden;
 margin-right: 5px; /* 5px is the width of the rounded shape */
}
/* Styles for each menu-item. */
.lavaLamp li a {
    font-size:16px;
    font-weight:normal;
    text-decoration:none;
    display:inline;
    color:#095BA6;
    text-align:center;
    margin: auto 12px;
    display: block;
    float: left;
    cursor:pointer;
    outline: none;
    z-index:10;
    height:30px;
    position:relative;
}

.lavaLamp li a:hover, .lavaLamp li a:active, .lavaLamp li a:visited {
    border: none;
}
.active {
    border: none;
    color:#000000;
    font-weight:bold;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:13:46+00:00Added an answer on May 29, 2026 at 11:13 pm

    Use a PHP if/else statement to add the class “current” to the li you’re on.

    something like:

    <li <?php if(strpos($_SERVER["PHP_SELF"],"index.php") !== false) echo 'class="current'; ?>><a href="index.php" >HOME</a></li>
    

    for each li, change “index.php” to whatever the filename it is. This is pretty inefficient… you could also do it like this:

    <?php
    $parts = Explode('/', $_SERVER["PHP_SELF"]);
    $currentFile = $parts[count($parts) - 1];
    ?>
    

    and then in each LI you can say:

    <li <?php if($currentFile == "index.php") echo 'class="current'; ?>><a href="index.php" >HOME</a></li>
    

    (source: http://www.scriptygoddess.com/archives/2007/07/13/use-php-to-get-the-current-pagefile-name/)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good afternoon all Here is my scenario: I have user controls within a master
Good afternoon In Java, I have HashSet which contain list of Object User which
Good afternoon, I'm having serious troubles getting my database back up and running. I
Good afternoon, I'm having a problem with a section of code I'm working on
Good Afternoon all , I have downloaded data from a web service and im
Good afternoon, I have a quick 'top level' question regarding the usage of Facebook
Good afternoon, I am having an issue with wordpress. I access to page123.domain.com and
Good afternoon to all, I have this scenario: I am using SQL Server 'BulkInsert'
Good afternoon I have a table that has customer id, name, computer, laptop, blah,
Good afternoon, I am having difficulties with libxml2. I tried to build the Perl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.