Possible Duplicates:
How do I embed an “a:hover{…}” rule into a style attribute in the middle of a document?
How to write a:hover in inline CSS?
I want to dynamically change the hover colour of an element, but not using external CSS stylesheets, only inline. This is the code (using php to generate the element)
echo '
<div class="container" style="color:#'.$color.'">
'.$contents.'
</div>';
When the user hovers over this container element, the color style will change to the value of $color
(at the moment there is no hovering).
Any help would be appreciated.
This will help you if javascript is appreciable
or
Javascript Change Hyperlink Text Color Onmouseover
You can't, since you can't set the pseudo-selectors inline. Ideally, you should design separate classes in your external css which would represent the various hover states you need, and in PHP assign these classes to your content.