Electric Type

Multimedia

About Us

News

Help

The Visited Link Color Bonanza
by Steve Mulder 5 Jul 1999

Steve Mulder is manager of information architecture in the user experience group of Terra Lycos, where he wears as many hats as possible. He pretends to know a lot about design strategy, interaction design, usability, writing for the Web, and Web development.

Page 1

Here's a nice little trick if you ever need more than one visited link color on a given Web page (here's an example). Let's say most of your links are blue, but your navigation links are white on a gray background. That's easy. The hard part is making your visited link colors different.

Why is it tricky? Because you need cascading stylesheets (CSS) to do it, and browser support for CSS is, shall we say, less than stellar.

Here's how it should work:

<STYLE TYPE="text/css">
<!--
A.nav:link { color: #FFFFFF }
A.nav:visited { color: #CCCCCC }
//-->
</STYLE>

The above code (which is tucked away in the <HEAD> of the HTML) establishes a stylesheet that defines a nav class with two "pseudoclasses." For all <A> tags with CLASS="nav", unvisited links will be white and visited links will be light gray.

Here's how it should work in the HTML of the page:

<A HREF="unvisited.html" CLASS="nav">
<FONT COLOR="#FFFFFF" FACE="Verdana" SIZE="2">
unvisited link
</FONT></A>

<A HREF="01.html" CLASS="nav">
<FONT COLOR="#FFFFFF" FACE="Verdana" SIZE="2">
visited link
</FONT></A>

Note: We have to include <FONT COLOR="#FFFFFF"> for each link, because otherwise browsers that don't recognize stylesheets will display the links as the default color.

So does this code work? Find out.

You probably just got some bad news. That's because our favorite (I use the word loosely) browsers, Communicator and Internet Explorer, don't give the CSS code priority as they are supposed to. Instead, <FONT COLOR="#FFFFFF"> overrides the CSS code, and the light gray visited link color doesn't show up. Sniff.

OK, I won't tease you. Let's look at the code that does work.

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.