tags:

views:

44

answers:

3

So instead doing it using css:

<style type="text/css">
a:visited {
   color: red;
}
</style>

Could it be done using inline code. Something like this doesn't work:

<a href="http://google.com" style='a:visited:color:red'>Google.com</a>
A: 

No, that's not how inline styles work. It is in the specification, however browsers don't seem to support it.

Ben Shelock
+1  A: 

You can't do this, the specification (CSS2 here) covers it briefly here:

Neither pseudo-elements nor pseudo-classes appear in the document source or document tree.

:visited along with the others modifiers are all pseudo-classes, and there was never a standard syntax setup to do what you're trying. Honestly this is the first time I've ever seen it requested, so I don't think it'll be added to the specification anytime soon...sorry that answer sucks, but it is what it is :)

Nick Craver
A: 

No. Pseduoclasses (e.g :first-child, :hover) are used as selectors based on behavior and relation to other DOM elements. Inline styles contain rules. Even if at some point browsers do support this, it'll feel weird.

cherouvim