nested class and :hover not working

lvh's Avatar


14 Nov, 2010 06:17 PM

Hi :)

I'm just experimenting with LESS and so far I've been very impressed, but I ran into a problem with a nested rule with :hover and .myClass:hover. Attached is the file, both with what I would have expected to work and the plain-old-CSS hack that makes it actually work.

I'm using LESS.js, should I be using the ruby script to see what CSS it produces?

thanks in advance

  1. 1 Posted by lvh on 14 Nov, 2010 10:37 PM

    lvh's Avatar

    FWIW I tested it with the :visited pseudoclass and that doesn't work either which leads me to believe I'm just doing something wrong.

  2. 2 Posted by Chris on 16 Nov, 2010 09:25 PM

    Chris's Avatar

    I've ran across this as well, my solution was to use the "&" symbol to force a:hover

  3. 3 Posted by kenmaclord on 06 Dec, 2010 05:46 PM

    kenmaclord's Avatar

    thanks for this tips, it work perfectly with the & symbol. The reason was that the nesting rule put a white space between nav and :hover. In CSS 'nav :hover' fails, but 'nav:hover' works.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac