View Full Version : Different coloured links


stone
01-11-2006, 11:12 PM
On this page (http://stonethegardener.com/) I'd like to have different coloured links in different coloured tables. I can't find where to plug in a link style in the new table, and <span style=>doesn't work with the java script.

Is there a code that I should put into the head for defining the tables? I haven't started using style in the head or style sheet yet, I appreciate any help clarifying this.

Krusifix
01-11-2006, 11:28 PM
You could include style="color: #" within each <a> tag, or create a selector for it, such as a.idName, and include the color within the style sheet.

stone
01-12-2006, 12:00 AM
Ok, <span style="color:#">doesn't work inside the java script.

I'd appreciate additional information on creating a.idname...sounds like it would work.

Krusifix
01-12-2006, 12:28 AM
I don't know much about the <span> tage, so I'll focus on the selector.


You can create subclasses within CSS, using a .className does that, so for the <a> tag, you'd put a.green (or whatever you wish to label the link), and then you would define what exactly a.green is:

a.green { color: #F7A8FD; }
Once you have this in your sheet, place the class object into the tag:

<a class="green" href="source.html">Greenery</a>
You can place as many of these as you want within the style sheet.



It might be better to code the links with an ID selector, but this works just as well. Also, adding the .green class object will not overwrite the basic style for the link to defaults. Such as if you had the font-weight change on all links, if you add this green class, it will not purely make it green and rewrite all other changes (unless those changes were changes to color).

Tracey
01-12-2006, 12:30 AM
With the idname I think this can help you:

<style type="text/css">
.idnamehere {color:00000;}
</style>

00000 needs to be replaced with the color you want to be, and for each link you want to be that color just do: <div class="idnamehere"><a href="http://">Link here</a></div>

Hope that helped, and worked....But it should I think.....It hasn't been tested though. ;)

Tracey

stone
01-12-2006, 01:46 AM
Krusifix's code did the trick! Thanks!

I couldn't make your code work at all Tracy, but thanks for the effort.