Johan Johan - 7 months ago 7
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?

Answer

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.

Comments