0

This is my fiddle: http://jsfiddle.net/2xnow6f8/2/. What I am trying to achieve is: - on hover statement on li to show my submenu. I saw this post . I tried to reproduce it but with no result. Can someone help me with this ? This is the code:

ul.mainmenu li:hover + div.header ul.mainmenu li div.submenu {display: block}
Community
  • 1
  • 1
Attila Naghi
  • 2,535
  • 6
  • 37
  • 59

3 Answers3

1

Its because ul.submenu is not directly after li

The + selector works like this:

Selects all <ul class='submenu'> elements that are placed immediately after <li> elements.

Since there are none,

Try adding a:hover instead of li:hover

http://jsfiddle.net/2xnow6f8/5/

For only hover on desktop:

http://jsfiddle.net/2xnow6f8/6/

Jacob
  • 1,933
  • 2
  • 20
  • 30
  • Try putting the submenu directly under li and see if that works! – Jacob Aug 27 '15 at 09:24