I am looking to design a navigation menu with items that can accommodate one or two lines of text.
https://i.sstatic.net/nkxRL.png
The items should have consistent height and the text should be vertically centered. Additionally, I want the entire box to be clickable, not just the text within it.
I made an attempt at creating this but only the text is clickable.
header .nav {
position: absolute;
top: 66px;
}
header .nav ul {
margin: 0;
padding: 0;
display: flex;
}
header .nav ul li {
list-style: none;
display: block;
position: relative;
margin: 0;
padding: 0;
width: 200px;
height: 80px;
font-family: 'Muli', sans-serif;
font-weight: 400;
font-size: 1em;
line-height: 1em;
border: 1px solid #fff;
overflow: hidden;
background-color: blue;
}
header .nav ul li a {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
text-decoration: none;
color: #1e1e1e;
padding: 10px 32px;
display: block;
}
header .nav ul li:hover {
border: 1px solid #1e1e1e;
}
<div class="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Two Line<br>Nav Item</a></li>
</ul>
</div>