Forum Moderators: not2easy

Message Too Old, No Replies

Link colors

         

Sothpaw

4:19 pm on Jun 14, 2007 (gmt 0)

10+ Year Member



for hyperlinks we use <a> to describe a set of information like colors and styles.

most of the links on my site are the same color (active, hover,etc.) and style. but i'm finding that for certain rare circumstances i want a link or more to have a different color series and style. i want this link to be on the same page as my normal links and would like the code to be imbeded into the main CSS page. can i make <a.DifferentLink> and access it with <a id="DifferentLink"> ?

benihana

4:23 pm on Jun 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



close.... :)

you need to code it like:

<a class="differentlink">

and write the css like so:

.differentlink {
color:#ff0000;
}

Xapti

4:36 pm on Jun 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well make sure you learn some basics on CSS
First there's the CSS syntax, which rather very simple.

first you type the identifier(s), which can be
#id
.class
element
an can be suffixed by a pseudo-element (:hover, :before, :active}
(or any mix such as:)
element1.class1 .class2 element2
element#id.class
.class1:hover .class2

Then curly bracket open "{"
your style information:
border: 1px solid #333333;
border-top:2px dotted #F00;
padding:bottom:2px;
all separated by semi-colons (last one doesn't separate, so it's optional)
then close bracket "}"

so yes for your case you'd want to make a new style definition, set it as a class (you can essentially only have 1 element per ID).

<style>
...
.differentlink{color:?different?}
.differentlink:hover{color:?different?}
...
</style>
...
<a class="differentlink"></a>

[edited by: Xapti at 4:37 pm (utc) on June 14, 2007]