Jump to content
  • 0

css вертикальное меню


erange
 Share

Question

Здравствуйте!

проблема в том, что третий уровень открывается с верху, а не напротив кнопки, которая его открывает :)

CSS:

#nav, #nav ul{
margin:0;
padding:0;
list-style-type:none;
list-style-position:outside;
position:relative;
line-height:1.5em;
display:inline-block;
z-index:1;
}

#nav a:link, #nav a:active, #nav a:visited{
outline:none;
display:block;
padding:0px 5px;
border:1px solid #333;
color:#fff;
text-decoration:none;
background-color:#333;
}

#nav a:hover{
background-color:#fff;
color:#333;
}

#nav li{
float:none;
position:relative;
width:180px;
}

#nav ul{
margin-left:10px;
margin-top:-10px;
position:absolute;
width:12em;
top:1.5em;
display:none;
}

#nav li ul a{
width:12em;
float:left;
}

#nav ul ul{
margin:0px;
padding:0px;
}

#nav li ul ul{
left:12em;
margin:0px 0 0 10px;
}

#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul{
display:none;
}

#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul{
display:block;
}

HTML:

<ul id="nav">
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a>
<ul>
<li><a href="">11</a></li>
<li><a href="">21</a></li>
<li><a href="">31</a></li>
<li><a href="">41</a></li>
<li><a href="">51</a>
<ul>
<li><a href="">12</a></li>
</ul>
</li>
<li><a href="">61</a></li>
</ul>
</li>
<li><a href="">4</a></li>
</ul>

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • 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. See more about our Guidelines and Privacy Policy