Monday, January 30, 2006

CSS Order Matters

Order matters in CSS.

When you define text-decoration for an a tag as follows

a:link {text-decoration: none}
a:hover {text-decoration: underline}
a:visited {text-decoration: none}


visited links do not get the hover style. They continue to use the visited style, since that is the last defining attribute. The following is the right way.

a:link {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: underline}

No comments: