Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS question

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
Hi guys,

This is a pretty stupid question but I'm new to CSS.

In my stylesheet I would like to define two styles for <a> links, how doI refer to them in the stylesheet and in the html script?

Thanks.
 
you have to name your style like so:

name.a {}
name2.a {}

you can replace name with whatever you want, then call it like this:

<a href=&quot; class=&quot;name&quot;>click</a> -Greg :-Q

flaga.gif
 
Hi,

I tried your solution but it doesnt seem to work, this is what I have in the stle sheet:

normal.a { text-decoration: underline; font-weight: bold }
normal.a:link { color: blue }
normal.a:visited { color: purple }
normal.a:active { background: yellow }
normal.a:hover { background: yellow }
navi.a { text-decoration: underline; font-weight: bold }
navi:link.a { color: black }
navi:visited.a { color: black }
navi:active.a { background: yellow }
navi:hover.a { background: yellow }

and this is how I refer to it in the html script:

<a href=&quot;products.shtml&quot;; class=&quot;navi&quot;>Products</a>
<a href=&quot;services.shtml&quot;; class=&quot;normal&quot;>Services</a>

What am I doing wrong?

Thanks.
 
Hi DeepBlerg,

It's :

a.navi { text-decoration: underline; font-weight: bold }
a.navi:link { color: black }
a.navi:visited { color: black }
a.navi:active { background: yellow }
a.navi:hover { background: yellow }

Further I think you do:

a.navi {text-decoration:underline; font-weight:bold; color:black }
a.navi:visited { color: black }
a.navi:active { background: yellow }
a.navi:hover { background: yellow }

Instead of:
a.navi { text-decoration: underline; font-weight: bold }
a.navi:link { color: black }

a.navi:visited { color: black }
a.navi:active { background: yellow }
a.navi:hover { background: yellow }

Hope this helps,

Erik
 
Also

Do not have a semicolon in the tag:

NOT:
Code:
<a href='...'; class='...'>...</a>
BUT:
Code:
<a href='...'  class='...'>...</a>

Cheers, Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top