Note that there are some explanatory texts on larger screens.

plurals
  1. POI can't deduce the function behind this, expert assistance is required
    text
    copied!<p>This little code that I've copied from a tutorial website explaining how to create a pure CSS horizontal menu, just when I thought I've finally understood how it worked, I discovered this thing and basically now I'm trying to reflect on all the things that I've learned in CSS, I'm stuck.</p> <p>So basically the code is like this, CSS.</p> <pre><code>#nav, .nav, #nav .nav li { margin:0px; padding:0px; } #nav li {float:left; display:inline; cursor:pointer; list-style:none; padding:0px 10px 0px 10px; border:1px #000 solid; position:relative;} #nav li ul.first {left:-1px; top:100%;} li, li a {color:#000; text-decoration:none;} #nav .nav li { width:100%; text-indent:10px; line-height:30px; margin-right:10px; border-top:1px #000 solid; border-bottom:1px #000 solid; border-left:none; border-right:none; background:#fff;} #nav li a {display:block; width:inherit; height:inherit;} ul.nav { display:none; } #nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; } li:hover &gt; .nav { display:block; position:absolute; width:200px; top:-2px; left:50%; z-index:1000; border:1px #000 solid; } li:hover { position:relative; z-index:2000; } </code></pre> <p>and the html,</p> <pre><code>&lt;ul id="nav"&gt; &lt;li&gt;Menu 1 &lt;ul class="nav first"&gt; &lt;li&gt;&lt;a href="#"&gt;Menu 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Menu 2&lt;/li&gt; &lt;li&gt;Menu 3&lt;/li&gt; &lt;li&gt;Menu 4&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;Menu 2&lt;/li&gt; &lt;li&gt;Menu 3&lt;/li&gt; &lt;li&gt;Menu 4&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Now this is where the problem begins, in the CSS, on the 9th line, yes, at the <code>li:hover &gt; .nav</code> part, when I change it to <code>#nav li:hover &gt; .nav</code>, the drop down menu just messes up, it won't behave like it should have, and I'm trying to uncover how a simple <code>#nav</code> can mess the layout, I've come up with some theories, but I can't seem to prove them since they contradict with some of the things that I've learned, I really need somehow who can explain this to me, I'm going nuts!</p> <p>If anyone, please, thank you.</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