Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate drop down menu without ul inside li
    text
    copied!<p>I want to create a drop down menu but I faced some problem:</p> <p>Actually I want to create it without making <code>&lt;ul&gt;</code> tag inside the <code>&lt;li&gt;</code> tag so the code :</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=utf-8 /&gt; &lt;title&gt;JS Bin&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li&gt;&lt;a&gt;Coffee&lt;/a&gt;&lt;/li&gt; &lt;ul&gt;&lt;li&gt;&lt;a&gt;Coffee 2&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;&lt;a&gt;Tea&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a&gt;Milk&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and the css code : </p> <pre><code>ul { font-family: Arial, Verdana; font-size: 14px; margin: 0; padding: 0; list-style: none; z-index: 1; } ul li { display: block; position: relative; float: left; } li ul { display: none; } ul li a { display: block; text-decoration: none; color: #ffffff; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #1e7c9a; margin-left: 1px; white-space: nowrap; } ul li a:hover { background: #3b3b3b; } li:hover ul { display: block; position: absolute; } li:hover li { float: none; font-size: 11px; } li:hover a { background: #3b3b3b; } li:hover li a:hover { background: #1e7c9a; } </code></pre> <p>You can see that <code>Coffee 2</code> is not dropdown it should be with coffe menu please help me without making the <code>&lt;ul&gt;</code> tag inside the <code>&lt;li&gt;</code>.</p> <p>jsbin link : <a href="http://jsbin.com/evasof/1/edit" rel="nofollow">http://jsbin.com/evasof/1/edit</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload