Jump to content

Drop out menu


Quendian

Recommended Posts

I have hacked together this CSS to make a drop out menu:

The only problem is that the drop out menus open up even if you don't hover your mouse over the link, e.g. you can hold your mouse on the other side of the page and the menu will pop out.

 

ul {

padding: 0;

margin: 0;

list-style-type: none;

}



li {

font: 12px Arial;

}



ul li {

position: relative;

}



li ul {

display: none;

}



li:hover ul{

position: absolute;

display: block;

border-bottom: thin solid black;

width: 120px;

background: rgb(255, 255, 255);

z-index: 1;

left: 125px;

top: 0;

}

Link to comment
Share on other sites

Sorry

 

<ul>
   <li><a class='menu' href='index.php?cat=Home'>Home</a>
      <ul>
         <li>test</li>
      </ul>
   </li>
</ul>

<ul>
   <li><a class='menu' href='index.php?cat=Contact'>Contact Us</a>
      <ul>
         <li>test</li>
      </ul>
   </li>
</ul>

 

Link to comment
Share on other sites

li elements are block elements, meaning they automatically have a 100% width (i.e. they fit the width of whatever container they are in). So you are probably hovering over the li tag, as it is stretching to the other side of the page, it just doesn't feel that way because the text inside the tag doesn't extend to the other side of the page. You need to set a width for your li tags if you don't want this to happen.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.