CSS Visited Link color not changing

Hello, I am working on a school project for my web development class. My project is complete other than one lingering issue. I can’t get visited links in my menus to change colors after they have been clicked on. Here is my current CSS (I added all of the #nav_list items, my teacher provided the rest of the code):

html {
background-image: url(“…/images/bats.gif”);
}
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
width: 800px;
background-color: white;
margin: 0 auto;
padding: 0;
border: 3px solid black;
box-shadow: 0 9px 18px 9px;
}
h1, h2, h3, p {
margin: 0;
padding: 0;
}
a {
font-weight: bold;
color: orange;
}
a:link, a:visited {
color: orange;
}
a:hover, a:focus {
color: green;
}

/* Header */
header {
background-image: -webkit-linear-gradient(45deg, white 0%, orange 75%, black 100%);
background-image: -moz-linear-gradient(45deg, white 0%, orange 75%, black 100%);
background-image: -o-linear-gradient(45deg, white 0%, orange 75%, black 100%);
background-image: linear-gradient(45deg, white 0%, orange 75%, black 100%);
padding: 15px;
border-bottom: 2px solid black;
}
header img {
float: left;
padding-right: 15px;
}
header h2 {
font-size: 230%;
}
header h3 {
font-size: 125%;
}

/* Sidebar */
aside {
float: left;
width: 160px;
padding: 20px 0;
}
aside ul {
line-height: 1.5;
}

/* Section */
section {
width: 580px;
float: right;
padding: 20px 40px 20px 20px;
}
section h1 {
font-size: 140%;
margin-bottom: .5em;
}
section h1:first-letter {
font-size: 240%;
}
section h2 {
font-size: 125%;
margin: .8em 0 .5em 0;
}
section h3 {
font-size: 110%;
margin: .8em 0 .5em 0;
}
section p {
margin-bottom: .5em;
}

/* Footer */
footer {
clear: both;
border-top: 2px solid black;
padding: 15px;
background-image: -webkit-linear-gradient(45deg, black 0%, orange 25%, white 100%);
background-image: -moz-linear-gradient(45deg, black 0%, orange 25%, white 100%);
background-image: -o-linear-gradient(45deg, black 0%, orange 25%, white 100%);
background-image: linear-gradient(45deg, black 0%, orange 25%, white 100%);
}
footer p {
font-size: 90%;
text-align: center;
}

/* menus */

  • { margin: 0;
    padding: 0; }

#nav_list ul li a {
display: block;
padding: .5em 0 .5em .5em;
color: red;
font-weight: bold;
}

#nav_list ul li a:link {
color: red;
text-decoration: none;
}

#nav_list ul li a:visited {
color: green !important;
}

#nav_list ul li a:hover, a:focus {
color: white; }

#nav_list ul {
list-style-type: none;
margin-bottom: 1.5em; }

#nav_list ul li {
width: 150px;
margin-bottom: -4px;
background-color: yellow;
border-width: 4px;
border-color: black;
border-style: solid;
position: relative;
padding: 0;
}

#nav_list ul li:hover {
background-color: orange;
}

#nav_list ul li:last-child {
margin-bottom: 0; }

#nav_list ul ul {
display: none;
position: absolute;
top: -4px;
left: 100%;
margin-left: 0; }

#nav_list ul li:hover > ul {
display: block; }

#nav_list > ul::after {
content: “”;
display: block;
clear: both; }

Hi! To make help possible also provide your HTML markup, please

For this question to come up with so much CSS, it must have already been in place. Like @ray-13 suggests, we need more context. Might one please link us to the exercise page so we can see for ourselves?

1 Like

Apologies, I’m still new to HTML and CSS. Here is a screenshot containing the HTML that I have added, which is everything inside the :

I hope this is helpful.

Hi,

It would make it easier if you can share your code in one of the following ways:

  1. Include your code (both CSS and HTML) as preformatted text by selecting your code and pressing the Preformatted text button in the editor (it looks like a closed tag symbol) or by starting an ending your code blocks with three back-ticks

example output:

My HTML:

<div>
<p> This is a paragraph</p>
</div>

MY CSS:

p {
color: red;
}

For more informatiobn read: Codecademy Forum: [How to] format code in posts

  1. For larger sections of code, it could be best to create a workspace from your Codecademy dashboard in the workspaces section, add your code, set the workspace to public and share the link with your code in a post.
    Learn more about Codecademy Workspaces
1 Like

Thanks, but please follow the instructions in the post below. Screenshots are almost useless for debugging big amounts of code.