I'm trying to create a horizontal menu but I'm having trouble with vertical alignment.
Some menu items have line breaks and some do not.
I tried to create a CSS to set the elements div
, ul
and li
so that they are aligned in the center vertically, but items that do not have line break, are aligned in the base of items that have break of lines.
I did an example on Fiddle and would like your help: Code on Fiddle
#menu{
background: #535454;
width: 100%;
overflow: hidden;
}
#menu ul{
list-style: none;
margin: 0;
padding: 0;
line-height: 1;
display: block;
}
#menu ul li{
display: inline-block;
max-width: 150px;
text-align: center;
}
#menu ul li a{
color: #ffffff;
text-decoration: none;
display: block;
padding: 15px 10px;
text-transform: uppercase;
position: relative;
}
#menu ul li a:hover{
color: #333333;
background: #00a4e6;
}
<div id="menu">
<ul>
<li>
<a href="#">Proteção para Cabeça</a>
</li>
<li>
<a href="#">Luvas</a>
</li>
<li>
<a href="#">Proteção para Torax</a>
</li>
<li>
<a href="#">Botas</a>
</li>
<li>
<a href="#">Proteção para Pernas</a>
</li>
</ul>
</div>
Thank you all!