Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS drop down menu main tab snag
    primarykey
    data
    text
    <p>I have been building a CSS drop down menu and I have a slight snag and wondered if anyone could help me fix this. I have a menu that has this HTML</p> <pre><code>&lt;div id="menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a class="active" href="#"&gt;Home&lt;/a&gt; &lt;ul class="sub-menu"&gt; &lt;li&gt;&lt;a href="#"&gt;This is sub&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;sub menu item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;This is a long sub menu item&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Location&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;another link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Currently when I hover over the main <code>&lt;li&gt;</code> 'Home' it's width expands a lot, I think to accommodate the sub-class menus that I have. How can I stop this from occurring? To achieve something like:</p> <p>|Home| // Nice short main tab<br /> |A sub menu link |<br /> |Another sub menu link|</p> <p>As opposed to this that is currently happening (forgive the crudeness of my diagram)</p> <p>|Home....................| // really long messing up everything tab<br /> |A sub menu link |<br /> |Another sub menu link|</p> <p>This is my CSS code for the menu:</p> <pre><code>#menu ul { margin: 0; list-style: none; padding: 0 0 0 20px; position: relative; z-index: 40; } #menu ul li { float: left; padding: 10px 10px 13px 0; position: relative; z-index: 50; } #menu li a { text-decoration: none; font-family: Verdana, Geneva, sans-serif; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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