views:

98

answers:

2
+1  Q: 

link order in css

Whats the correct order of styling the <a> element (link, visited, hover, active). All are confusing by providing different combination like LVHA, LAHV. Can anybody specify the correct ordering?

+4  A: 

Link Visited Hover Active

To quote from the CSS specification:

a:link    { color: red }    /* unvisited links */
a:visited { color: blue }   /* visited links   */
a:hover   { color: yellow } /* user hovers     */
a:active  { color: lime }   /* active links    */

Note that the A:hover must be placed after the A:link and A:visited rules, since otherwise the cascading rules will hide the 'color' property of the A:hover rule. Similarly, because A:active is placed after A:hover, the active color (lime) will apply when the user both activates and hovers over the A element.

Daniel A. White
when a visited it turns all links color to visited color.why it happens
Paniyar
Because you visited all links before? Just a guess ...
Joey
no its happens newly loaded page.
Paniyar
Have you visited the pages the links point to before? May well be months ago. You can try making up links you never visited before to test unvisited links. In developing a web site I noticed you usually have visited all links that appear.
Joey
i fix the problem. my links are all point to same page(#) .anyway thanks for your post
Paniyar
A: 

You might prefer VLHA ordering as well, which makes no difference. However CSS spec specified LVHA ordering and, in fact, this one is easy to memorize: i LoVeHA!

Comptrol