i am currently working with a school task by making a webpage, but i can't seem to figure out how to align an image/icon with the other buttons in the navbar. I have tried to finsd the answer, but i can't seem to find the answer after several google search. Also, i am limited to html and css only and not allowed to use tools like bootstrap. my code for this page is below:
HTML code:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Zero hunger</title>
<link rel="stylesheet" href="css/master.css">
</head>
<body>
<nav>
<ul>
<li><img class="nav-img" src="images/2-zero-hunger.png"></li>
<li class="nav-button"><a href="index.html">Home</a></li>
<li class="nav-button"><a href="contact.html">Contact</a></li>
<li class="nav-button"><a href="game.html">Game</a></li>
</ul>
</nav>
<div class="">
<p>Hello World</p>
</div>
</body>
</html>
CSS code:
body{
margin: 0;
font-family: sans-serif;
}
/*Navbar*/
nav ul{
margin: 0;
padding: 0;
text-align: center;
background-color: #D09E37;
}
nav ul li{
list-style: none;
display:inline-block;
}
nav ul li.nav-button{
padding: 0 15px;
}
nav ul li.nav-button:hover{
background-color: #bf8000;
}
nav ul li a{
text-decoration: none;
font-size: 1.5em;
color: white;
line-height: 54px;
}
.nav-img{
height: 58px;
display: inline-block;
}