dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: UL navigation bar link to change when clicked

  1. #1
    Join Date
    Feb 2010
    Posts
    4

    UL navigation bar link to change when clicked

    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!

  2. #2
    Join Date
    Mar 2007
    Posts
    946
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles