title: How to display submenu on dropdown using positioning and CSS?
body: <p>I have this simple navigation menu for my design. But the problem is I can't display the sub menu when hovered. Is there any way to solve this? Or does my CSS has some missing styles?</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-css lang-css prettyprint-override"><code>nav ul {list-style-type: none; overflow: hidden; background: #000; position: relative;}
  nav li {float: left;}
  nav li &gt; a {padding: 15px 15px; display: inline-block; text-decoration: none; color: white; text-align: center;}
  nav li &gt; a:hover {background: violet;}
  
  nav ul ul { position: absolute; background: green; top: 100%;}
  nav ul ul li &gt; a:hover {color: red;}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;sample UL&lt;/title&gt;
      &lt;style media="screen"&gt;
  
      &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;nav&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;Menu 1&lt;/a&gt;&lt;/li&gt;
          &lt;ul&gt;
            &lt;li&gt;&lt;a href="#"&gt;submenu 1&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;submenu 2&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/ul&gt;
      &lt;/nav&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>