Johan Johan - 9 months ago 14
HTML Question

How to use CSS hover inside html-tag?

I want to do something like this:

<li style="hover:background-color:#006db9;">

But it wont work. Is this possible to do in some way, or do I have to write the css in the head or external css-document?


This is not possible using the style attribute. You'll have to use CSS, either in the document itself or in an external file.

li:hover { background-color:#006db9; }

If that's not an option then you'll have to resort to JavaScript.