David19801 David19801 - 1 year ago 112
CSS Question

Change all link states same color css

I have a spanned class called "tomato".

My css is:

.tomato a:link {color:#FF0000;} /* unvisited link */
.tomato a:visited {color:#FF0000;} /* visited link */
.tomato a:hover {color:#FF0000;} /* mouse over link */
.tomato a:active {color:#FF0000;} /* selected link */

Is there a way I can combine all these into a smaller piece of code? (I want the link to be red in all states)

Answer Source

This is the shortest, I don't think you can do it any shorter than:

.tomato a:link, .tomato a:visited, .tomato a:hover, .tomato a:active { color:#FF0000; }


.tomato { a:link, a:visited, a:hover, a:active { color:#FF00000; } }

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download