Reputation: 131
hi I'm trying to create a vertical navigation bar as can be found as a jsfiddle The navigation bar is meant to expand and collapse while using css/jquery. I'm lost in the css as while expanding the sub menu's don't appear at the bottom where I expected them but on the right?
.csm {
list-style: none;
padding: 0 0 0 0;
margin: 0 0 0 0;
}
.csm div {
text-align: right;
float: left;
display: block;
cursor: pointer;
background-color: #D3EDFB;
width: 95%;
max-width: 27em;
}
ul.csm {
display: block;
list-style: none;
margin: 0;
padding: 0;
text-align: right;
}
.csm ul {
display: none;
}
.csm ul li {
display: block;
cursor: auto;
}
.csm a {
background-color: #D3EDFB;
display: block;
}
Can someone give me a hint about where I'm messing up?
Gert
Upvotes: 1
Views: 944
Reputation: 379
It may be overkill, but jQuery's accordion behaves this way: http://jqueryui.com/accordion/
Upvotes: 0
Reputation: 92893
This is because .csm div
is set to float: left
.
Remove that, and the submenus will appear below them as desired -- although you may have to tweak the rest of your CSS to make it look consistent.
Upvotes: 0
Reputation: 2820
Is this better http://jsfiddle.net/kfLaZ/1/
I changed the following
.csm div
to
.csm li
Upvotes: 2