I want to have the class="children"
centered in the middle of the page container preferably using css only but if it is not possible you can provide the best js answer. Currently it is just a normal drop down but I want to use it as a mega menu. If I have to add another div structure that's fine.
<div class="main-navigation-wrapper">
<div class="nav pull-left">
<div class="menu-main-menu-container">
<ul id="menu" class="menu no-dropdown">
<li class="menu-item">
<a href="#">Blog</a>
<div class="children">
--- Children items are here
</div>
</li>
</ul>
</div>
</div>
</div>
I have seen some other examples but have attempted a few and none of them center it. I want to find a dynamic approach to where no matter the location of the link in the menu it always centers the menu in the container.
EDIT: Fiddle found here http://jsfiddle.net/YzJ4h/
The simplest would be to add this CSS to horizontaly center your mega menu items :
CSS :
#menu li, .second-menu li {
display:inline-block;
position:relative;
}
#menu > li.mega_width {
display:inline-block;
position:static;
}
#menu > li.mega_width > .children {
position:absolute;
left:0;
right:0;
top:auto;
margin:auto;
}
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With