Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CSS "active page indicator"

Posted on 2007-03-27
2
Medium Priority
?
335 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 2000 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

Industry Leaders: 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

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

610 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