...

View Full Version : Css Links



jakenoble
02-09-2004, 10:03 AM
question is about CSS and links.

I can get underline effect, background change, etc by using .a but i need to have more than one sort of link in my page, e.g. menu links cannot have the same effect as links in the main text.

How do i set up more than two link effects?

rmedek
02-09-2004, 10:24 AM
hi jakenoble,

you can use classes, like this:
...css...

a {
text-decoration:underline;
}

a.red {
color:red;
}

a.white {
color:white;
}

...HTML...

<a href="#">This is a normal, underlined link.</a>
<a class="red" href="#">This is a red link.</a>
<a class="white" href="#">This is a white link.</a>

-Rich

glenngv
02-09-2004, 10:26 AM
A:link { ... }
A:visited { ... }
A:active { ... }
A:hover { ... }

A.class1:link { ... }
A.class1:visited { ... }
A.class1:active { ... }
A.class1:hover { ... }

A.class2:link { ... }
A.class2:visited { ... }
A.class2:active { ... }
A.class2:hover { ... }

...
<a href="page.htm">link 1</a>
<a href="page2.htm" class="class1">link 2</a>
<a href="page3.htm" class="class2">link 3</a>

LinuxGold
02-09-2004, 01:12 PM
You can also do classes in divisions i.e...


#header .black {border: 1px dashed black; color: black;}
#sidebar .black{border: 1px solid black; color: #e0e0e0;}

jakenoble
02-09-2004, 04:24 PM
Cheers guys, that hits the nail right on the head.

Jake



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum