From: Karsten Wutzke on
Hello,

what I'm doing is pretty trivial: display a nav tree and mark the
currently active elements in the tree in boldface (much like a
breadcrumb). I use the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<style>
ul.subnav a
{
color: #444;
text-decoration: none;
}

ul.subnav a:hover
{
text-decoration: underline;
color: red;
}

/* not working as expected */
ul.subnav li.active a
{
font-weight: bold;
}

</style>
</head>
<body>

<ul class="subnav">
<li><a href="/Home" class="menuItem">Home</a></li>
<li><a href="/Projects" class="menuItem">Projects</a></li>
<li class="active"><a href="/Technology"
class="menuItem">Technology</a>
<ul>
<li class="active"><a href="/Technology/Papers"
class="menuItem">Papers</a>
<ul class="subnav4">
<li><a href="/Technology/Papers/SQL_Best_Practices"
class="menuItem">SQL Best Practices</a></li>
<li class="active"><a href="/Technology/Papers/PeperTwo"
class="menuItem">PeperTwo</a></li>
</ul>
</li>
<li><a href="/Technology/Tools" class="menuItem">Tools</a></li>
<li><a href="/Technology/APIs" class="menuItem">APIs</a></li>
</ul>
</li>
<li><a href="/Contact" class="menuItem">Contact</a></li>
</ul>

</html>

I thought this would work, as the rule

ul.subnav li.active a

was supposed to boldface active li's links, but the whole tree from
that point is marked.

What am I doing wrong? How do I fix this?

TIA
Karsten
From: Chris F.A. Johnson on
On 2010-04-30, Karsten Wutzke wrote:
> Hello,
>
> what I'm doing is pretty trivial: display a nav tree and mark the
> currently active elements in the tree in boldface (much like a
> breadcrumb). I use the following code:
>
....
> I thought this would work, as the rule
>
> ul.subnav li.active a
>
> was supposed to boldface active li's links, but the whole tree from
> that point is marked.
>
> What am I doing wrong? How do I fix this?

ul.subnav li.active > a

--
Chris F.A. Johnson <http://cfajohnson.com>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)