Quendian Posted June 22, 2009 Share Posted June 22, 2009 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 More sharing options...
haku Posted June 23, 2009 Share Posted June 23, 2009 Without the HTML, the CSS tells us nothing. Link to comment https://forums.phpfreaks.com/topic/163222-drop-out-menu/#findComment-861753 Share on other sites More sharing options...
Quendian Posted June 23, 2009 Author Share Posted June 23, 2009 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 More sharing options...
haku Posted June 24, 2009 Share Posted June 24, 2009 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 More sharing options...
Quendian Posted June 24, 2009 Author Share Posted June 24, 2009 That worked like a charm, thank you. Link to comment https://forums.phpfreaks.com/topic/163222-drop-out-menu/#findComment-862542 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.