Jörg Reinholz: How to use a click event instead of :hover

Beitrag lesen

Moin!

For the li-element you can change "onclick" the style (one way ist to add or remove a class) with javascript.

But i think the best way is to define the :hover and :focus for the anchor (<a>), not for the list item <li>.

In this case set the padding and margin for the list item to zero, add the padding and margin to the anchor and set the list-item-sign (if you need them) with before:: tho the anchor.

Jörg Reinholz