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

Thread: <a> tag syntax

  1. #1
    Join Date
    Oct 2005
    Posts
    8

    Smile <a> tag syntax

    There was an issue I use to run into pretty often when I wanted to add rollover effects to links. Sometimes they would work and other times they wouldn't.

    Turns out the reason was due to the order of the (link, visited, hover, and active) states.

    If you do not have them in the proper oder they will not work. The only reason that I could get them to work sometimes is because I would just get lucky.

    An easy way to remember the proper order is LoVe HAte
    L=link
    V=visited
    H=hover
    A=active

    Here is an example of the proper way to stack the css code:
    navlink:link{color=#ff0000}
    navlink:visited{color=#ffff00}
    navlink:hover{color=#0000ff}
    navlink:active{color=#ff0000}

    If you stack these in any other order the effects will not be predictable.

    I hope this helps!
    Last edited by dogznbonz; 05-06-2006 at 11:05 PM.

  2. #2
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    your CSS code is wrong. There are no equal signs in CSS

    navlink:link{color:#ff0000}
    navlink:visited{color:#ffff00}
    navlink:hover{color:#0000ff}
    navlink:active{color:#ff0000}

    I would also reccomend adding an a before navlink, or whatever you want your class name to be.

    a.navlink:link{color:#ff0000}
    a.navlink:visited{color:#ffff00}
    a.navlink:hover{color:#0000ff}
    a.navlink:active{color:#ff0000}

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