Forums
This topic is locked
colored links
Posted 02 May 2005 21:53:02
1
has voted
02 May 2005 21:53:02 Henry Craig posted:
Hi,Is it possible to have different colored links on the same page, since page properties only allows for one color. For example in the body of the page I want to use blue text links, but in the bottom nav I want to use white text links
thanks,
Henry Craig
Replies
Replied 03 May 2005 11:21:23
03 May 2005 11:21:23 Wayne Hultum replied:
You can use CSS to achieve what you want. You can put the code below in the head of your page or put the bit in between the style tags in a external style sheet. You can change the fonts and colours to whatever you want.
<style type="text/css">
a.newsLink:link, a.newsLink:visited{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:10px;
color:#FFFFFF;
text-decoration:none;
}
a.newsLink:hover, a.newsLink:active{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:10px;
color:#01195E;
text-decoration:none;
}
a.nav:link, a.nav:visited{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:9px;
color:#CCCCCC;
font-weight:bold;
text-decoration:none;
}
a.nav:hover, a.nav:active{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:9px;
color:#FFFFFF;
font-weight:bold;
text-decoration:none;
}
</style>
to make the links use the styles you need to put a class tag in link <b>link 1 a href="#" class="nav"</b> <b>link 2 a href="#" class="newsLink"</b>.
I hope this makes sense.
Wayne
<style type="text/css">
a.newsLink:link, a.newsLink:visited{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:10px;
color:#FFFFFF;
text-decoration:none;
}
a.newsLink:hover, a.newsLink:active{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:10px;
color:#01195E;
text-decoration:none;
}
a.nav:link, a.nav:visited{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:9px;
color:#CCCCCC;
font-weight:bold;
text-decoration:none;
}
a.nav:hover, a.nav:active{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:9px;
color:#FFFFFF;
font-weight:bold;
text-decoration:none;
}
</style>
to make the links use the styles you need to put a class tag in link <b>link 1 a href="#" class="nav"</b> <b>link 2 a href="#" class="newsLink"</b>.
I hope this makes sense.
Wayne
Replied 03 May 2005 15:51:23
03 May 2005 15:51:23 Matt Bailey replied:
Another way is if you are using DIVs to lay out your page you can give each DIV a unique ID and then style any HTML within it. For example:
<b>CSS:</b>
<pre id=code><font face=courier size=2 id=code>div#div1 p {
font: 12px Arial, Helvetica, sans-serif;
color: #993366;
}
div#div1 a {
color: #CC3333;
}
div#div1 a:hover {
color: #003399;
}
div#div2 p {
font: 12px "Times New Roman", Times, serif;
color: #339999;
}
div#div2 a {
color: #3399CC;
}
div#div2 a:hover {
color: #FF9966;
}</font id=code></pre id=code>
<b>HTML:</b>
<pre id=code><font face=courier size=2 id=code><div id="div1"><p>Test text 1. <a href="#">Test link 1</a></p></div>
<div id="div2"><p>Test text 2. <a href="#">Text link 2</a></p></div></font id=code></pre id=code>
___________________________________
* Sorry... how do you do that again?... *
<b>CSS:</b>
<pre id=code><font face=courier size=2 id=code>div#div1 p {
font: 12px Arial, Helvetica, sans-serif;
color: #993366;
}
div#div1 a {
color: #CC3333;
}
div#div1 a:hover {
color: #003399;
}
div#div2 p {
font: 12px "Times New Roman", Times, serif;
color: #339999;
}
div#div2 a {
color: #3399CC;
}
div#div2 a:hover {
color: #FF9966;
}</font id=code></pre id=code>
<b>HTML:</b>
<pre id=code><font face=courier size=2 id=code><div id="div1"><p>Test text 1. <a href="#">Test link 1</a></p></div>
<div id="div2"><p>Test text 2. <a href="#">Text link 2</a></p></div></font id=code></pre id=code>
___________________________________
* Sorry... how do you do that again?... *
Replied 03 May 2005 23:10:28
03 May 2005 23:10:28 Henry Craig replied:
I'll give it a try. Thanks for the help.