Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   HTML Link Colour (https://www.cableforum.uk/board/showthread.php?t=33668676)

LSainsbury 21-08-2010 16:51

HTML Link Colour
 
Hi,

HTML for Thickies #101 :dunce:

How do I change a HTML a href link colour?


I've read there can be different colours for the link depending on the state (never clicked, clicked etc) but I want it one colour (white) regardless of it's state.

How do I do that?

Thanks!

Sir John Luke 21-08-2010 18:03

Re: HTML Link Colour
 
http://www.codeave.com/html/code.asp?u_log=5027

punky 21-08-2010 18:14

Re: HTML Link Colour
 
Quote:

Originally Posted by Sir John Luke (Post 35076464)

That's the old way.

In your CSS file add this:

Code:

a:link {
color:#FF0000;
}
a:visited {
color:#FF0000;
}
a:hover {
color:#FF0000;
}
a:active {
color:#FF0000;
}

link = link hasn't been clicked
visted = link has been viisted
hover = mouse is over link
active = mouse is clicking link

The order they are listed is crucial!

Colours are numbers between 0-255 (as strength) converted to 2 digit hexadecimal (so 0 = 00 and 255 = FF) in the order Red Green Blue with no spaces and has a # at the start.

So red is #FF0000 etc. Black is #000000 and white is #FFFFFF

punky 21-08-2010 20:22

Re: HTML Link Colour
 
Just noticed you wanted your links white so it should be:

Quote:

a:link {
color:#FFFFFF;
}
a:visited {
color:#FFFFFF;
}
a:hover {
color:#FFFFFF;
}
a:active {
color:#FFFFFF;
}

dev 21-08-2010 21:26

Re: HTML Link Colour
 
Easier to just put them in one go:

Quote:

a:link, a:visited, a:hover, a:active { color: #FFFFFF; }

LSainsbury 22-08-2010 00:31

Re: HTML Link Colour
 
Cool - thanks - so where do I inset that code into the <a href> command?

Strzelecki 22-08-2010 00:38

Re: HTML Link Colour
 
If you want the styling inline with the href tag then you will have to use something like:
Code:

<a style="color:#FFFFFF;" href="my-page.php">Link text</a>
The code others have posted should either be in a separate stylesheet included on the page in the <head> section, like:
Code:

<head>
<link rel="stylesheet" type="text/css" href="mystylesheet.css" />
</head>
<body>
.....

or in <style type="text/css"></style> tags in the <head> section.

LSainsbury 22-08-2010 10:10

Re: HTML Link Colour
 
Thanks for the advice - all fixed up! :)


All times are GMT +1. The time now is 03:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum