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 8810221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:04:39+00:00 2026-06-14T03:04:39+00:00

I’m just trying to create a simple menu. So when you click a link,

  • 0

I’m just trying to create a simple menu. So when you click a link, it directs you to another page and shows you that you selected that link by changing colour.

The problem I have is when I click a link within the list, the page loads and for some reason the list elements all enter the a:visited field. Setting them to red. I have the JSFIDDLE Here. I know its simple but it’s getting on my nerves.

CSS Code:

ul.nav_style{list-style: none;}

ul.nav_style li {padding-left: 1em; text-indent: -.7em;}

ul.nav_style li:before {
    content: "•  ";
    color: #C0C0C0; /* or whatever color you prefer */
}

ul.nav_style li a:link { color: #C0C0C0; text-decoration: none;}
ul.nav_style li a:visited { color: #FF0000; text-decoration: none;}
ul.nav_style li a:hover { color: #58595B; text-decoration: none;}
ul.nav_style li a:active { color: #E6BD13; text-decoration: none;}​

HTML Code:

<ul class="nav_style">
    <li><a href="#">Link 1</a></li>
    <li><a href="#">Link 2</a></li>
    <li><a href="#">Link 3</a></li>
    <li><a href="#">Link 4</a></li>
</ul>

Thanks in advance.

Chris

  • 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-06-14T03:04:40+00:00Added an answer on June 14, 2026 at 3:04 am

    Problem solved, I’ve decided to just use PHP to generate my lists using arrays and an if statement to give the current page its css class.

    PHP CODE:

    if($title == "Enter"){
    
                  $enterArrayPages = array("competition.php","full_detail.php", "judges.php", "get_involved.php", "employers.php");
                  $enterArrayText = array("The Competition","Full Detail","The Judges","Get Involved", "Employers");
    
                  echo '<ul class="nav_style">';
                  for($i=0; $i<sizeof($enterArrayPages); $i++){
    
                    if($proper_title == $enterArrayText[$i]){
                      echo '<li><a class="linkChange" href="'.$enterArrayPages[$i].'">'.$enterArrayText[$i].'</a></li>';
                    }
                    else{
                      echo '<li><a class="menu_links" href="'.$enterArrayPages[$i].'">'.$enterArrayText[$i].'</a></li>';
                    }
                  }
                  echo '</ul>';
                }
    

    So as you can see, the code loops through each of the pages stored in an array and if the title of the page is equal to the one in the array I change its class, making the color of the link different to the others.

    Here is the CSS:

    a.menu_links:link { color: #58595B; text-decoration: none;}
    a.menu_links:visited  { color: #58595B; text-decoration: none; }
    a.menu_links:active { color: #E6BD13; text-decoration: none; }
    a.menu_links:hover  { color: #E6BD13; text-decoration: none; }
    
    .linkChange {
       color: #E6BD13;
       text-decoration: none;
    }
    

    It’s really simple, I just had to think of the logic via PHP. I thought that implementing it in pure css would be good enough, but with time ticking, I resorted to PHP.

    Here is an image of the code output:

    Code Output, You can see how my code, gets the current page and changes the colour of the link, in this scenario with Mentors and What is Service being highlighted.

    Thanks for everyones comments! Much appreciated!

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace

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.