Solved

CSS "active page indicator"

Posted on 2007-03-27
2
328 Views
Last Modified: 2012-06-27
Hi there!

When I define:

#divNavigation li a:hover
{
background-image: url(../tableleftdown.gif);
color: #336699;
}

in my Master.css page it works as expected, that is, when the mouse goes through the Navigation link, the image appears and the color of the text is altered.

What I would like to know is how to make EXACTLY the same effect to the Navigation link where the user is (that is, to indicate the page the user is).  

I have already tried to create

#divNavigation li a:current
{
 background-image: url(../tableleftdown.gif);
 color: #336699;
}

and

#divNavigation li a:active
{
 background-image: url(../tableleftdown.gif);
 color: #336699;
}

and nothing happens.

Thanks,
fskilnik
0
Comment
Question by:fskilnik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
VirusMinus earned 500 total points
ID: 18804438
CSS cannot determine what page the user is currently on.

the only states available on links are :link, :visited, :hover and :active (this is the color when you click your mouse on the link to the point that you release the mouse)

to do what you're after, either through server side code or in the HTML give the current page a class

eg.

<div id="divNavigation">
<ul>
<li><a href="xyz.htm" class="current">xyz</a></li>
<li><a href="xyz.htm" >xyz</a></li>
<li><a href="xyz.htm" >xyz</a></li>
</ul>


now in your css do this;

#divNavigation li a:hover, #divNavigation li a.current
{
background-image: url(../tableleftdown.gif);
color: #336699;
}
0
 

Author Comment

by:fskilnik
ID: 18809297
Great explanation, great answer.

100% successfull.     :)

Thanks A LOT, VirusMinus!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question