easy css question: font color

liunx

Guest
Hi there.

I have one link, but within that link I need to have 2 link colors. First word one one color, second word another.

Is there a way to do this without breaking the words into two separate links?You could do this:

<html>
<head><title>2 color link</title>
<style type=text/css>
.color2 {color: green;}
</style>
</head>
<body>
<p>This is a test of a <a href=http://www.webdeveloper.com/forum/archive/index.php/"#">two-color <span class=color2>link</span></a>. It is only a test</p>
</body>
</html>The entire link comes up green in IE 5.2 on the Mac. Weird.Originally posted by nyc_courtney
The entire link comes up green in IE 5.2 on the Mac. Weird.
I agree: weird.

By the way, just curious: wy do you "need" to have a differently-colored word within a link? It goes against the norm and therefore could be confusing to users.Not a word actually, a symbol: &rsaquo;&rsaquoI dont use ie 5.2, but I'm guessing this might make the links show up different colors.


<html>
<head>
<title>
Two colored-link
</title>

<style type="text/css">

.color1 {
color: #f00;
}

.color2 {
color: #000;
}


</style>

</head>
<body>

<p>
This is a <span class="color1">two</span> <span class="color2">colored</span> link.</p>

</body>
</html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a><!-- m -->">

<html lang="en">
<head>
<title>Example</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<style type="text/css">
a:link, a:visited {
color: #326094;
}
.odd {
color: #945C32;
}
</style>
</head>
<body>
<ul>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"">Link <span class="odd">One</span></a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"">Link <span class="odd">Two</span></a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"">Link <span class="odd">Three</span></a></li>
</ul>
</body>
</html>
I don't know about IE 5.2, but that'll work in 5.0, 5.5, and 6.0.
 
Back
Top