I'm pretty new to this stuff, but I'm creating a website for a project and currently I've been trying to fix my active link and nothing so far has worked. I am also using W3school spaces.
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="navbar">
<ul>
<li id="link1"><a href="home.html">Home</a></li>
<li id="link2"><a href="info.html">Info</a></li>
<li id="link3"><a href="photo.html">Photos</a></li>
<li id="link4"><a href="credit.html">Credits</a></li>
</ul>
</div>
</body>
</html>
CSS:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
#navbar ul #link1 a:hover {
background-color: #C62222;
}
#navbar ul #link2 a:hover {
background-color: #0000ff;
}
#navbar ul #link3 a:hover {
background-color: #BB29BB;
}
#navbar ul #link4 a:hover {
background-color: #28C622;
}
a:active {
background: #29abe2;
}
The reason for the multiple links and colors is the rubric required for all links on the navbar to be assigned a different color.
These are what i've tried:
.navigation a:active{
background: #29abe2;
color: #fff;
border-radius: 5px; }
#page1:target, #page2:target, #page3:target, #page4:target, #page5:target{
background: #29abe2;
color: #fff;
border-radius: 5px;
}
Sadly none of these have worked for me