This is what I'm trying to accomplish. I have a unordened list as a horizontal menu.
The <li>
should be vertical aligned in the middle, like this:
_______________________________________ | | | | | [____] [____] [____] [____] | | | |_______________________________________|
No problem so far, using vertical-align: middle
and a line-height
. The challenge is that I want to be able to have two lines, and have them aligned in the middle aswell, like this:
_______________________________________ | | | [____] [____] [____] [____] | | | | [____] [____] [____] | |_______________________________________|
The code so far: HTML
<ul>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
</ul>
CSS
ul {
margin: 0;
padding: 0;
width: 500px;
height: 100px;
background: lightblue;
text-align: center;
list-style: none;
vertical-align: middle;
line-height: 100px;
}
ul li {
display: inline;
}
ul li a {
padding: 5px 15px;
margin: 0 10px;
background: lightgreen;
}
I already found this and this, but that doesn't help me either.
I created a single line JSFiddle and a multi line JSFiddle.