Page 1 of 1

Making one link change color when moused over

Posted: Wed Feb 26, 2003 11:20 pm
by nigma
Hey lets say I have 10 links on site. When someone mouses over one I want just that ones text to change blue ( note: not the other links, just the one moused over).

Anyone know how I can do this?

Thanks for all help and advice provided.

Posted: Thu Feb 27, 2003 1:00 am
by volka
now this is a client-side question ;)
css defines a pseudo-class a:hover that applies to anchor-elements that have the focus

Code: Select all

<html>
	<head>
		<style type="text/css">
			a:hover &#123; color: white; background-color: blue; &#125;
		</style>
	</head>
	<body>
		<a href="javascript:void(0)">link a</a><br />
		<a href="javascript:void(0)">link b</a><br />
		<a href="javascript:void(0)">link c</a><br />
		<a href="javascript:void(0)">link d</a><br />
	</body>
</html>

Posted: Thu Feb 27, 2003 3:52 am
by bionicdonkey
assign the anchor to a css class e.g

a.class:hover {
color: #0000FF;
}


then

<a class="class" href="http://www.example.com">Example</a>

Posted: Thu Feb 27, 2003 2:08 pm
by nigma
Thanks a bunch! That worked perfectly