Jump to content

Navigation drop down menu


cliftonbazaar

Recommended Posts

I am trying to create a vertical navigation drop down menu where, if you hover the mouse over the parent, a drop down sub-menu appears on the right.

With the code I have the sub menu comes up OVER the parent menu at the top left of the navigation DIV; I want the sub menu to appear on the right of the parent menu and also the top sub menu to appear next to the parent.

 

HTML code is

<li><a href='games.php'>Games</a>
<ul>
<li><a href='games/crivia.php'>Crivia</a></li>
<li><a href='games/sleuth.php'>Super Sleuth</a></li>
</ul>
</li>

 

while my full CSS looks like

#navigation {
width: 12em;
border-right: 1px solid #000;
padding: 1em 0 1em 0;
margin-top: 1em;
margin-bottom: 1em;
font-family: 'Trebuchet MS', 'Lucida Grande',
  Verdana, Lucida, Geneva, Helvetica, 
  Arial, sans-serif;
background-color: black;
color: #333;
cursor: pointer;
	display:block;
position:relative;
}

#navigation ul {
list-style: none;
margin: 0;
padding: 0;
border: none;
}

#navigation li {
border-bottom: 1px solid #90bade;
margin: 0;
}

#navigation li a,active {
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 10px solid black;
border-right: 10px solid red;
background-color: maroon;
color: #fff;
text-decoration: none;
width: 100%;
}

#navigation li a,active {
width: auto;
}

#navigation li a:hover {
border-left: 10px solid black;
border-right: 10px solid maroon;
background-color: grey;
color: #fff;
position: relative;
}

#navigation li active {
border-left: 10px solid black;
border-right: 10px solid red;
background-color: red;
color: black;
}

#navigation ul ul{
position:absolute;
display:none;
}

#navigation ul li:hover ul{
position:absaloute;
display:block;
top:0;
}

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.