As you can see the icon and the text are perfectly fit and lined up well on the first image.
I am not sure how can I make them fit together and aligned well such as the icon must not be higher than the text.
Here's my code doing that.
<nav>
<ul>
<li><a href="#"><span id="home"></span> Home</a></li>
<li><a href="#"><span id="notif"></span>Notifications</a></li>
<li><a href="#"><span id="msg"></span>Messages</a></li>
</ul>
</nav>
Here's the CSS:
nav{
display: inline-block;
width: 30%;
float: left;
height: 30px;
display: inline-block;
margin-top: -15px;
}
nav ul{
margin-left: -42px;
}
nav ul li{
float: left;
display: inline;
margin-right: 15px;
list-style: none;
}
nav ul li a{
text-decoration: none;
color: #66757f;
font-size: 14px;
font-weight: bold;
}
span{
margin-right: 4px;
margin-top: 10px;
}
span#home{
width: 20px;
height: 18px;
background: url('../img/home.png') no-repeat;
display: inline-block;
}
span#notif{
width: 20px;
height: 18px;
background: url('../img/bell.png') no-repeat;
display: inline-block;
}
span#msg{
width: 20px;
height: 18px;
background: url('../img/messages.png') no-repeat;
display: inline-block;
}