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
https://forums.phpfreaks.com/topic/163222-drop-out-menu/
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
https://forums.phpfreaks.com/topic/163222-drop-out-menu/#findComment-861785
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
https://forums.phpfreaks.com/topic/163222-drop-out-menu/#findComment-862479
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.