Interview Questions

How can I specify two different sets of link colors?

CSS Interview Questions and Questions


(Continued from previous question...)

114. How can I specify two different sets of link colors?

By classifying each set of links and then attaching desired color to each set.
CSS:
<style type="text/css">
<!--
A.set1:link {color: some_color; background: some_background_color}
A.set1:visited {color: some_color; background: some_background_color}
A.set1:active {color: some_color; background: some_background_color}

A.set2:link {color: some_color; background: some_background_color}
A.set2:visited {color: some_color; background: some_background_color}
A.set2:active {color: some_color; background: some_background_color}
-->
</style>

You can name set1 and set2 any way you like as long as the names are made up of letters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code.
Note: to avoid conflict with user's settings a background property (background color) should also be specified together with the color property (foreground color).

(Continued on next question...)

Other Interview Questions