Solved

CSS "active page indicator"

Posted on 2007-03-27
2
325 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

756 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