[thelist] simple html css question

Alex Bejoy Bejoy.Alex at blr.spcnl.co.in
Fri Jun 28 07:53:46 CDT 2002


PeterV Wrote:
> How do you do that again when you want
> a link to be grey not underlined and
> when someone hovers over it blue not
> underlined? I suck at CSS, honestly...
> and i'm at home without my books
> --------------------------------------------------

First declare the stylesheet like this:

<style type="text/css">
<!--
/* Defining a class of anchor called Special
   Can be any other name as well */
a.Special {
	color: #CCCCCC;
	text-decoration: none;
}

/* How a.Special should behave on MouseOver */
a.Special:hover {
	color: BLUE;
	text-decoration: none;
}

/* Other options are visited and active */
a.Special:visited {
	...
}

a.Special:active {
	...
}
-->
</style>


Then, use your hyperlink like this:
	<a class="Special" href="..." >My Link</a>

All links used with class="Special" will show the behavior.

Code snippet has been tested in IE/Opera.

HTH,
Bejoy



More information about the thelist mailing list