Solved

CSS "active page indicator"

Posted on 2007-03-27
2
327 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to delete "dots" above Bootstrap 3 navbar 4 118
GET error with Font Awesome 3 50
Bootstrap 3 - Style a dropdown 1 32
boostsrap 1 34
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

734 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