JavaScript in CSS isn't possible in modern browser - except for any currently supported URL parameters (e.g. background-image
) where javascript:
URLs will cause any script to be executed.
See this answer, but I've summarised here.
moz-binding
was possible in Firefox 2 & 3, and an identified flaw was later mitigated, however support was dropped in future versions.
HTML Components haven't been supported since Internet Explorer 10, so there is little point in developing a website that relies on this technology.
CSS Expressions are only supported in IE5/7 quirks/standards mode respectively.
Are you looking to create an exploit, or to achieve some functional requirement using CSS? If the former, concentrate on URL parameters or breaking out of the CSS context into JavaScript. Also UI redress may be possible to trick the user into believing site content you inject is authoritative. If the latter, then go down a different route rather than shoehorning CSS to acheive script execution.