• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 841
  • Last Modified:

:hover pseudo class in style attribute

In the css specification there is outlined how to put pseudo classes in HTML's style attribute.


I have tried to get this working but have not been successful. I need this because with javascript I would rather tack on a css hover inline than state a javascript event for the effect.

Has anyone ever got inline pseudo classes to work?

I do not need solutions for how to get hover to work with javascript or by stating the pseudo class outside of inline, I can code that any day. My question is a topic of just inline pseudo classes.

Thank you for your support!

Here is an example of a test that does not work in FF 3.5 or IE8.
<div style="{color:#000; background-color:#ff0000;}:hover{background-color:#fffff0; color:#fff;}">Hover me</div>

Open in new window

Shaye Larsen
Shaye Larsen
1 Solution
Pseudo classes only work with some selectors such as anchor tags. I don't think you can apply them to a div tag.
Shaye LarsenAuthor Commented:
I see. Thanks for your help. I sure wish that the standard wasn't limited like that.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now