I currently have a CSS <ul><li>
dropdown menu that uses the following code. Unfortunately I want the sub menus to display in 2 columns as there are about 16 items in that submenu. Does anyone know how to use the following code to make this drop down menu 2 columns?
.menu {
border: none;
border: 0px;
margin: 0px;
padding: 0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
.menu ul {
background: #006633;
height: 35px;
list-style: none;
margin: 0;
padding: 0;
}
.menu li {
float: left;
padding: 0px;
}
.menu li a {
background: #006633 url("../images/seperator.gif") bottom right no-repeat;
color: #ffffff;
display: block;
font-weight: normal;
line-height: 35px;
margin: 0px;
padding: 0px 25px;
text-align: center;
text-decoration: none;
}
.menu li a:hover,
.menu ul li:hover a {
background: #003f20 url("../images/hover.gif") bottom center no-repeat;
color: #FFFFFF;
text-decoration: none;
}
.menu li ul {
background: #006633;
display: none;
height: auto;
padding: 0px;
margin: 0px;
border: 0px;
position: absolute;
width: 225px;
z-index: 200;
/*top:1em;
/*left:0;*/
}
.menu li:hover ul {
display: block;
}
.menu li li {
background: url('../images/sub_sep.gif') bottom left no-repeat;
display: block;
float: none;
margin: 0px;
padding: 0px;
width: 225px;
}
.menu li:hover li a {
background: none;
}
.menu li ul a {
display: block;
height: 30px;
font-size: 12px;
font-style: normal;
margin: 0px;
padding: 0px 10px 0px 15px;
text-align: left;
}
.menu li ul a:hover,
.menu li ul li:hover a {
background: #003f20 url('../images/hover_sub.gif') center left no-repeat;
border: 0px;
color: #ffffff;
text-decoration: none;
}
.menu p {
clear: left;
}
<div class="menu">
<ul>
<li><a href="#" target="_self">Main Item 1</a></li>
<li><a href="#" target="_self">Main Item 2</a>
<ul>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
</ul>
</li>
<li><a href="#" target="_self">Main Item 3</a></li>
<li><a href="#" target="_self">Main Item 4</a></li>
<li><a href="#" target="_self">Main Item 5</a></li>
<li><a href="#" target="_self">Main Item 6</a>
<ul>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
<li><a href="#" target="_self">Test Sub Item</a></li>
</ul>
</li>
</ul>
</div>
Hey, 7 years later the columns
css property is well supported
ul{
columns: 2;
}
<ul>
<li>first item</li>
<li>second item</li>
<li>third item</li>
<li>fourth item</li>
<li>fifth item</li>
</ul>
You could probably get a similar effect with the very robust grid
Make the ul
twice as wide as the li
's and float the li's left
http://www.behemothdan.com/2011/05/faux-mega-menu-in-wordpress/
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