Anchor element experiment with CSS1.jim.cerny@unh.edu
This is an experiment in changing default link colors (the HTML anchor element, "A") which is not normally a good thing to do, as Jakob Nielsen pointed out with item 8 in his original 1996 list of the top ten mistakes in Web design We look at it here because sometimes a change in link colors is necessary to work with a non-white background color or pattern, and it helps round out your understanding of CSS1 by introducing pseudo-classes. Pseudo-classes are used for elements whose treatment is not just positional. As a CSS technology demonstration this page shows first the specification of a new set of default colors for the triplet of hyperlink-associated colors (link, active, visited) associated with the anchor element. These colors are darkgreen, yellow, orange. Then it shows how to selectively override that default on the same page, using blue, red, gray. Note, the active link color does not act as I would expect. With Explorer 5.5 the "alink" value is only applied the first time a link is visited. With Netscape 4.72 the non-default value is used as the "alink" color for both default and non-default style settings. With Opera 4.01 an "alink" color does not seem to be used under any conditions. Try it with your favorite browsers! Then study the source code, since anchor element colors have special treatment as CSS pseudo-elements. New default colors for pageThis is a hyperlink to the IBM front page. Exception to the new default.And this is a hyperlink to the Compaq front page. Continued use of default.Now let's visit the Slash Dot page. See the W3C CSS1 specification on pseudo-classes and the CSS test suite. |