I have this css menu on fiddle: http://jsfiddle.net/DenErello/pQhpu/
css:
.Menu {
background-color: #3b69a2;
height: 30px;
}
.Menu, .Menu li {
list-style: none;
padding: 0;
margin: 0;
}
.Menu li {
float: left;
width: 100px;
display: block;
line-height: 30px;
}
.Menu ul {
opacity: 0;
}
.Menu ul li {
line-height: 20px;
background-color: #3b69a2;
}
.Menu li:hover > ul { opacity: 1; }
html:
<ul class="Menu">
<li>Test 1
<ul>
<li>Test 1.1</li>
<li>Test 1.2</li>
</ul>
</li>
<li>Test 2
<ul>
<li>Test 2.1</li>
<li>Test 2.2</li>
<li>Test 2.3</li>
</ul>
</li>
</ul>
Now, this works great and all. But what I want is to see both drop down menus after going on 1 of the main menu items. I can't quite figure it out, anyone on how to do this? And in addition I'd like to see a full 100% width background with it and full height of the dropdown as the biggest dropdown. I tried with background and all on ul but it seems like it doesn't work
Fiddle
I think your code needs a dose of this.
No javascript needed, add this to your css:
See it here http://jsfiddle.net/pQhpu/4/
You can do this pretty easily with jQuery. Unless there's a reason you're using
opacity
to hide and show the dropdowns, I'd recommend usingdisplay
instead.See DEMO.
You can get the first top-level item triggering both sub-menus with this:
http://jsfiddle.net/pQhpu/1/
It doesn't work on the second top-level item because the adjacent sibling selector only applies to following siblings. You'll need JavaScript for this. It's easy with jQuery.
I am not sure I really understand, but what if you use the hover property on .Menu ? So that you have both menus display when you have your mouse over the whole area ?
Then, to have the full width, I would add the following rule :
http://jsfiddle.net/pQhpu/5/
Otherwise, I would second isherwood and say you need some javascript.