Log in

View Full Version : Html link help


ittle
Jul 6, 2006, 05:41 PM
Okay so I'm making my website, but for example on my index.html I have a link for home.html, the word "home" is supposed to be yellow and not underline, but instead it is blue and underlined. Need help!

LTheobald
Jul 7, 2006, 12:41 AM
I'll do this the bad way - I'm writing up a CSS guide for this site over the weekend so check back to this category later if you want some guidance on doing it the proper way.

In between the <head> tags of your HTML page put this:


<style>
a {
text-decoration: none;
color: yellow;
}
</style>


That will make all links on your page yellow and not-underlined. If you want just certain links coloured yellow, place the following between your <head> tags:



<style>
.link {
text-decoration: none;
color: yellow;
}
</style>


Then make your HTML links look like this:

<a href="home.html" class="link">a link</a>

Just a quick note - Removing the underline on links if often "frowned upon". It makes it quite hard to tell what is a link and what isn't.

NeedKarma
Jul 7, 2006, 02:47 AM
Ummm... is it possible it's blue because it's a followed (already clicked) link?

ittle
Jul 7, 2006, 01:31 PM
Ummm...is it possible it's blue because it's a followed (already clicked) link?
I like your answer but no. check it out! At www.littledan1.com
(the page the link is directing to hasn't been built so just look at my scripting and see what the problem is

LTheobald
Jul 10, 2006, 12:25 AM
Dan, that link won't work. If the page/link isn't there we can't look at your scripting.

Secondly, my first answer will colour the links like you asked.

ittle
Jul 10, 2006, 07:08 PM
ACTUALLY IT DID. I wrote the style scripting you told me and it worked. Look at it.

BBeepTX
Jul 21, 2007, 12:21 AM
Here is an old HTML code way to do links with forced color... use Font tags


<a href="home.html"><font color=yellow>HOME</font></a>

ittle
Jul 28, 2007, 12:44 PM
My bad, the link doesn't work, cause I was lazy and I lost the domain name.

nickfromstrood
Jul 28, 2007, 01:46 PM
Not too sure about the underlining, but as for colour I would put the following in my body tag to make links yellow:

<body alink="yellow" vlink="yellow" link="yellow">

this will cover:

A(ctive) links - as you click on them

V(isited links

and also unclicked links

hope this is some help :s

jstrike
Aug 2, 2007, 07:05 AM
The first set of styles will change all links that do not have a class specified in the anchor tag. The second set will only be applied to those links that have the class value set to myLinkStyle. If you are going to remove the underline from a link you should make sure that it's obvious to the user that there is a link there. What we will typically do is surround the link with [ ].

Oh... and sorry for the ugly colors... I just chose stuff off the top of my head.
Your styles would contain:


<style>
a:link {
color: green;
text-decoration: none;
}
a:visited {
color: yellow;
text-decoration: none;
}
a:hover {
color: green;
text-decoration: underline;
}
a:active {
color: green;
font-weight: bold;
text-decoration: none;
}

a.myLinkStyle:link {
color: cyan;
text-decoration: none;
}
a.myLinkStyle:visited {
color: orange;
text-decoration: none;
}
a.myLinkStyle:hover {
color: cyan;
text-decoration: underline;
}
a.myLinkStyle:active {
color: cyan;
font-weight: bold;
text-decoration: none;
}
</style>


And then your links in the body:


This is a link to [ <a href="http://www.yahoo.com">Yahoo</a> ]<br>
This is a link to [ <a href="http://www.google.com" class="myLinkStyle">Google</a> ]