Forum Moderators: not2easy

Message Too Old, No Replies

Defining an Anchor Pseudo Class Inline

Can this be done?

         

webguru

6:38 am on Apr 30, 2003 (gmt 0)

10+ Year Member



I can define these css styles like this:

<head>
<style type="text/css">
a:link, a:visited { text-decoration : none; }
a:hover { text-decoration : underline; }
</style>
</head>

however what happens if i don't want to define them like that? I want to call them inside the <a href> instead:

<a STYLE="" href="">link</a>

I try this but didn't work:

<a style="a:link, a:visited { text-decoration : none; } a:hover { text-decoration : underline; } href="">link</a>

Nick_W

7:09 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, can't be done :(

----I hate saying things like that, I'm usually wrong! - Can't think of a way though....

Nick

webguru

7:57 am on Apr 30, 2003 (gmt 0)

10+ Year Member



i don't believe that it can't be done. there must be someone who knows how to do it.

grahamstewart

9:52 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope - Can't do it and I can't think of any good reason you'd want to. :)

Nick_W

10:06 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Damn good point Graham, whats the reasoning behind this, we might be able to come up with a viable alternative...

Nick

papabaer

10:19 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The only reason I can think of is would be an attempt to "style" links posted to guestbooks, forums and other such places. But as it stands, the very nature of the construct is doomed to fail... geez, sounds kinda foreboding!

I agree totally! Why would you even want to do this? (even considering the above possible explanation!)

BlobFisk

11:25 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you really intent on doing it (and I'll add my voice to the "can't see why" chorus!), you may be able to use javascript to accomplish the effect.

onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"

By no means ideal, and I havn't tested it at all....