title: 2 level responsive menu doesn't display block
body: <p>I'm trying to make my old menu responsive for smaller screen sizes. I get the menu icon working properly, but when I open the list it displays inline instead of block. I tried several options but could not get it work right. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myFunction() {
      var x = document.getElementById("myTopnav");
      if (x.className === "menu") {
          x.className += " responsive";
      } else {
          x.className = "menu";
      }
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>/* Main menu */
  
  
  .menu
  {
   width: 100%;
   margin: -15px 0 0 0;
   padding: 0 0 0 0;
   list-style: none;
   background: #d1d1d1;
   background: -moz-linear-gradient(#d1d1d1, #b6b6b6);
   background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #d1d1d1),color-stop(1, #b6b6b6));
   background: -webkit-linear-gradient(#d1d1d1, #b6b6b6);
   background: -o-linear-gradient(#d1d1d1, #b6b6b6);
   background: -ms-linear-gradient(#d1d1d1, #b6b6b6);
   background: linear-gradient(#d1d1d1, #b6b6b6);
   border-bottom: 4px solid #005da2;
   -moz-box-shadow: 0 2px 1px #9c9c9c;
   -webkit-box-shadow: 0 2px 1px #9c9c9c;
   box-shadow: 0 2px 1px #9c9c9c;
  }
  
  .menu li
  {
   float: left;
   padding: 0 0 10px 0;
   position: relative;
   line-height: 0;
   border-right: 1px solid #b6b6b6;
  }
  
  .menu li:hover {
   background: #0186ba;
   background: -moz-linear-gradient(#04acec,  #0186ba); 
   background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
   background: -webkit-linear-gradient(#04acec,  #0186ba);
   background: -o-linear-gradient(#04acec,  #0186ba);
   background: -ms-linear-gradient(#04acec,  #0186ba);
   background: linear-gradient(#04acec,  #0186ba);
   /*-moz-box-shadow: 0 0 2px rgba(255,255,255,.5);
      -webkit-box-shadow: 0 0 2px rgba(255,255,255,.5);
      box-shadow: 0 0 2px rgba(255,255,255,.5); 
      -moz-border-radius: 5px;
      border-radius: 5px;*/
   z-index: 9999 !important;
  }
  
  .menu a 
  {
   float: left;
   height: 25px;
   padding: 10px 25px 0 25px;
   color: #000;
   text-transform: uppercase;
   font: bold 12px/25px Arial, Helvetica;
   text-decoration: none;
  }
  
  .menu li:hover &gt; a
  {
   color: #fafafa;
  }
  
  *html .menu li a:hover /* IE6 */
  {
   color: #fafafa;
  }
  
  .menu li:hover &gt; ul
  {
   display: block;
   z-index: 9999 !important;
  }
  
  /* Sub-menu */
  
  .menu ul
  {
      list-style: none;
      margin: 0;
      padding: 0;    
      display: none;
      position: absolute;
      top: 45px;
      left: 0;
      z-index: 9999 !important;    
      background: #444;
      background: -moz-linear-gradient(#444, #111);
      background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
      background: -webkit-linear-gradient(#444, #111);    
      background: -o-linear-gradient(#444, #111); 
      background: -ms-linear-gradient(#444, #111); 
      background: linear-gradient(#444, #111);
      -moz-box-shadow: 0 0 2px rgba(255,255,255,.5);
      -webkit-box-shadow: 0 0 2px rgba(255,255,255,.5);
      box-shadow: 0 0 2px rgba(255,255,255,.5);
  }
  
  .menu ul ul
  {
    top: 0;
    left: 150px;
    z-index: 9999 !important;
  }
  
  .menu ul li
  {
      float: none;
      margin: 0;
      padding: 0;
      display: block;  
      -moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
      -webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
      box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
  }
  
  .menu ul li:last-child
  {   
      -moz-box-shadow: none;
      -webkit-box-shadow: none;
      box-shadow: none;    
  }
  
  .menu ul a
  {    
      padding: 10px;
   height: 40px;
   width: auto;
   height: auto;
      line-height: 1;
      display: block;
      white-space: nowrap;
      float: none;
   text-transform: none;
   color: #fff;
  
  }
  
  *html .menu ul a /* IE6 */
  {    
   height: 10px;
  }
  
  *:first-child+html .menu ul a /* IE7 */
  {    
   height: 10px;
  }
  
  .menu ul a:hover
  {
      background: #0186ba;
   background: -moz-linear-gradient(#04acec,  #0186ba); 
   background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
   background: -webkit-linear-gradient(#04acec,  #0186ba);
   background: -o-linear-gradient(#04acec,  #0186ba);
   background: -ms-linear-gradient(#04acec,  #0186ba);
   background: linear-gradient(#04acec,  #0186ba);
  }
  
  .menu ul li:first-child &gt; a
  {
      -moz-border-radius: 5px 5px 0 0;
      border-radius: 5px 5px 0 0;
  }
  
  .menu ul li:first-child &gt; a:after
  {
      content: '';
      position: absolute;
      left: 30px;
      top: -8px;
      width: 0;
      height: 0;
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-bottom: 8px solid #444;
  }
  
  .menu ul ul li:first-child a:after
  {
      left: -8px;
      top: 12px;
      width: 0;
      height: 0;
      border-left: 0; 
      border-bottom: 5px solid transparent;
      border-top: 5px solid transparent;
      border-right: 8px solid #444;
  }
  
  .menu ul li:first-child a:hover:after
  {
      border-bottom-color: #04acec; 
  }
  
  .menu ul ul li:first-child a:hover:after
  {
      border-right-color: #04acec; 
      border-bottom-color: transparent;  
  }
  
  
  .menu ul li:last-child &gt; a
  {
      -moz-border-radius: 0 0 5px 5px;
      border-radius: 0 0 5px 5px;
  }
  
  /* Clear floated elements */
  .menu:after 
  {
   visibility: hidden;
   display: block;
   font-size: 0;
   content: " ";
   clear: both;
   height: 0;
  }
  
  
  ul.menu li.icon {display: none;}
  
  /* When the screen is less than 680 pixels wide, hide all list items, except for the first one ("Home"). Show the list item that contains the link to open and close the topnav (li.icon) */
  @media screen and (max-width:680px) {
    ul.menu li:not(:first-child) {display: none;}
    ul.menu li.icon {
      float: right;
      display: inline-block;
    }
  }
  
  /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens */
  @media screen and (max-width:680px) {
    ul.menu.responsive {position: relative;}
    ul.menu.responsive li.icon {
      position: absolute;
      right: 0;
      top: 0;
    }
    ul.menu.responsive li {
      float: none;
      display: inline;
    }
    ul.menu.responsive li a {
      display: block;
      text-align: left;
    }
  }
  
  * html .menu             { zoom: 1; } /* IE6 */
  *:first-child+html .menu { zoom: 1; } /* IE7 */</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>     &lt;!--MENU--&gt;
          &lt;ul class="menu" id="myTopnav"&gt;
              &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Videos&lt;/a&gt;
                &lt;ul&gt;
        &lt;li&gt;&lt;a href="#"&gt;Videos 1&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Videos 2&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Videos 3&lt;/a&gt;&lt;/li&gt;
                 &lt;/ul&gt;
           &lt;/li&gt;
                
        &lt;li&gt;&lt;a href="#"&gt;Headlines&lt;/a&gt;
               &lt;ul&gt;
   &lt;li&gt;&lt;a href="#"&gt;Headlines All&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Headlines Last Week&lt;/a&gt;&lt;/li&gt;
                 &lt;/ul&gt;
              &lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Pictures&lt;/a&gt;&lt;/li&gt;
            &lt;/li&gt;
  &lt;li class="icon"&gt;
      &lt;a href="javascript:void(0);" onclick="myFunction()"&gt;&amp;#9776;&lt;/a&gt;
    &lt;/li&gt;
  
  
  
   
   </code></pre>
  </div>
  </div>
  </p>