I'm trying to work out a generic Responsive Menu for some websites that I'm helping with. I've got it working okay with JavaScript and I've got a CSS version that works fine if you don't have sub-menus. However, I'm trying to work out a responsive menu with just CSS that works fine with submenus.
So, the basic HTML/CSS for the page is:
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <meta name="generator" content="PSPad editor, www.pspad.com">
    <style>
      /* Basic layout */
        body {background-color: grey;}
        nav {background: green; color: white;}
        /* Menu Icon */
        nav div.menu-icon {background: green url("menu.png") no-repeat; height: 32px; padding: 0px;}
        /* Menu lines */
        nav div ul {list-style-type: none; padding: 0px; /* Stops us getting a gap above */ margin: 0px;  /* Stops us getting a gap to the left */}
        nav div a:link {color: white; text-decoration: none;}       
        nav div a:visited {color: white; text-decoration: none;}           
        nav div a:hover {color: white; text-decoration: none; font-weight: bold;}       
        nav div a:active {color: white; text-decoration: none; font-weight: bold;}
        /* Indent sub-menus */
        nav div ul ul {padding-left: 1em;}
        nav div ul ul ul {padding-left: 2em;}
        nav div ul ul ul ul {padding-left: 3em;}
      /* End Basic layout */
    </style>
    <title>Menu Test</title>
  </head>
  <body>
    <nav id="MainMenu">
      <div class="menu-icon"></div>
      <div class="SideMenu">
        <ul>
          <li class = "has-sub">
            <a href = "#"> Submenu 1 >> </a>
            <ul>
              <li class = "is-link">
                <a href = "Menu1.html">Example Menu 1</a>
              </li>
                    <li class = "has-sub">
                    <a href = "#"> Submenu 2 >> </a>
                      <ul>
                  <li class = "is-link">
                    <a href = "Menu4.html">Example Menu 4</a>
                  </li>
                  <li class = "is-link">
                    <a href = "Menu5.html">Example Menu 5</a>
                  </li>
                        </ul>
                    </li>
            </ul>
          </li>           
          <li class = "is-link">
            <a href = "Menu2.html">Example Menu 2</a>
          </li>
          <li class = "is-link">
            <a href = "Menu3.html">Example Meun 3</a>
          </li>
        </ul>
      </div>    
    </nav>
  </body>
To make it responsive, I've added the following style block:
    <style>
      /* Drop-down menu */
        /* Hide the menu unless we're hovering over it */
        div.SideMenu {display:none;}
        div.SideMenu ul li ul li {display: none;}       
        /* Hover over the icon and display the menu */
        nav#MainMenu:hover div.SideMenu {display: block;}
        nav#MainMenu:hover div.SideMenu > ul {display: block;}
        div.SideMenu ul > li:hover > ul > li {display: block;}
      /* End Drop-down menu */  
    </style>
This almost works.
When I hover over the 'burger', the top-level menu drops down. when I hover over one of the 'parent' entries in the menu, the sub-menu drops down.
However when I move below the last of the sub-menu items, the whole menu collapses, meaning that I can never access Menu 2 or Menu 3.
I've tried all sorts of different approaches, but can't get this to work as I want.
Can anyone see what I've done wrong please?
