Forum Moderators: open

Message Too Old, No Replies

Inline CSS Links style

is it possible?

         

tata668

8:54 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Let's say I want ONE particular link to turn red on mouseover, is there a way to set some inline CSS to achieve that?

Something such as:


<span style="a-hover:red;"><a href="http://www.google.com">my link</a></span>

The only way I'm able to do it for now is to use a class:


<style type="text/css">
.myRedLink A:hover
{
color:Red ;
}
</style>
<span class="myRedLink"><a href="http://www.google.com">my link</a></span>

DanA

9:14 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



<head>
<style type="text/css">
.myRedLink a:hover
{
color:red ;
}
</style>
[...]
</head>
<body>
<a class="myRedLink" href="http://www.google.com">my link</a>
[...]
</body>
should be all right

Span

9:26 pm on Apr 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Years ago I read a draft on W3 in which was a proposal for inline pseudo style. I'm not going to try to find that again... at the moment there's just no way to make :hover work inline.

tata668

9:26 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Ok thanks, that's true: I don't need a span.

But my question is: Is it possible to use inline CSS to change a link style? Without using classes or IDs?

Thanks

tata668

9:26 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Thanks Span...

DanA

9:31 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



You can't. a:hover has to be defined in a stylesheet or in the head

Robin_reala

10:05 pm on Apr 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As a side note, you might want to set a span that describes the link's purpose rather than it's appearance - that way if you change the look and feel in the future (as I've been doing to my pages recently) you won't have stuff like .myredlink {background-color: blue;}...