Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Menu - Problem showing current location with a:active

Status
Not open for further replies.

jonohara

Technical User
Mar 26, 2000
53
GB
I've a html/css menu in which I want to show the current position/selection (i.e. url) in white. What seems to happen is that when the menu item is clicked from another page the a:active colour (white) is briefly visable but the text then reverts to the a:visited colour.

Is there a way of either setting the importance of the a:active colour higher than visited or of removing the a:visited function all together?

Thanks
 
html

Code:
<p><span class=&quot;menuhead&quot;><a href=&quot;mainpage.asp?contentid=27&quot;>Industry Areas</a></span><br>
        <span class=&quot;menucont&quot;>Automotive<br>
        Mineral/Waste<br>
        Industrial/Mineral<br>
        Mineral/FGD<br>
        Sewage/Water Treatment</span></p>
<p><span class=&quot;menuhead&quot;><a href=&quot;mainpage.asp?contentid=28&quot;>Products</a></span><br>
        <span class=&quot;menucont&quot;>Thickeners<br>
        Linear Screens<br>
        Horizontal Belt Filter<br>
        Rotary Presses</span><br>
      </p>

css class

Code:
.menuhead A:link{  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #006633; text-decoration: none}

.menuhead a:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #000000; text-decoration: none }

.menuhead a:hover {  font-size: 14px; font-weight: bold; color: #006633; text-decoration: none; clip:    rect(   )}

.menuhead a:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #FFFFFF; text-decoration: none }

Thanks again
 
Are you looking for a way to hilight the &quot;current&quot; link in your navbar, in other words the link representing the page you're currently on?

Unfortunately CSS doesn't know how to do that, even though it does know how to hilight links that you've visited :)visited) or are hovering your cursor over :)hover) or are in the process of using :)active).

There are any number of workarounds. I personally use PHP or JSP to generate the nav dynamically and insert class=&quot;current&quot; in the appropriate tag. My CSS looks like this then:
Code:
<style>
a.current { color: white; }
</style>
-petey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top