a:active question (I think)

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
btd
Forum Newbie
Posts: 5
Joined: Thu Nov 13, 2008 12:32 pm

a:active question (I think)

Post by btd »

In the page below I have a menu with 3 choices: * Services, * link1, and * link2.
When I click on link 1 or 2 and the page is loaded I expect CSS to display that link in a different color (acitve)
The color is always the same. why?
Is active link the one that caused the page to be displayed?

------------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
ul#navlist { font-family: sans-serif; }

ul#navlist a
{
font-weight: bold;
text-decoration: none;
}

ul#navlist, ul#navlist ul, ul#navlist li
{
margin: 0px;
padding: 0px;
list-style-type: none;
}

ul#navlist li
{
float: left;
}

ul#navlist li a
{
color: #ffffff;
background-color: #338800;
padding: 3px 7px;
border: 1px #ffffff outset;
}

ul#navlist li a:hover
{
color: #ffff00;
background-color: #003366;
}

ul#navlist li a:active
{
color: #cccccc;
background-color: #003366;
border: 1px #ffffff inset;
}

</style>
</head>

<body>

<div id="navcontainer">
<ul id="navlist">

<li><a href="#" >Services</a></li>
<li><a href="test.html" >link1</a></li>
<li><a href="test1.html">link2</a></li>
</ul>
</div> <!-- end id="navcontainer"> -->
<div id="content">
<h2>Our motto.</h2>
<p> column Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut .</p>
<p>&nbsp;</p>
</div> <!-- end id="content"> -->

</body>
</html>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: a:active question (I think)

Post by social_experiment »

btd wrote:Is active link the one that caused the page to be displayed?
Yes. The :active pseudo element only works when you click on the link. In what browser are you experiencing this problem?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply