Click to See Complete Forum and Search --> : UL navigation bar link to change when clicked


ToddFur
02-26-2010, 10:58 AM
Hi-

Could someone take a look at http://www.bensbells.org/Test2.html

I have a navigation bar that I created using CSS.

I thought that the below CSS UL code would change and STAY when clicked -- so that the user can see what section of navigation s/he is currently on.

ul#menu li a.active {
color:#FFFFFF;
}

However it does not -- and I was told that I might need some javascript to get what I want to work? Does anyone have an example or website I can look at to get this work, I seem to not be able to find one.

Thanks!

skywalker2208
02-26-2010, 11:29 AM
The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it.

http://www.w3.org/TR/CSS2/selector.html#pseudo-elements


Note: a:active MUST come after a:hover in the CSS definition in order to be effective!

http://www.w3schools.com/Css/pr_pseudo_active.asp

I would suggest not using javascript because it can be turned off and the you lose the effect. I suggest using server side code that checks the page you are on and then adds a class with the needed effect.