Basically, I'm practicing HTML & CSS using flexbox and I cannot set my navigation menu and logo vertically. I've using align items, but nothing.
This is how it currently looks:
As you can see, it looks uneven, the "brand" logo looks upper than my nav menu. How should I fix it?
This is my code:
/* General selector*/
* {
margin: 0%;
padding: 0%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
background: #f2f2f2;
}
/*General selector ends*/
/* header*/
.container {
display: flex;
width: 80%;
max-width: 800px;
}
/*nav bar*/
.logo {
margin: 20px;
}
.logo a {
text-decoration: none;
color: black;
font-size: 45px;
}
.nav {
display: flex;
justify-content: flex-end;
}
.nav a {
color: black;
text-decoration: none;
font-weight: bold;
text-align: center;
margin: 20px;
padding: 20px;
font-size: 20px;
}
.nav li {
list-style: none;
}
.nav a:hover {
color: gray;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<!--header-->
<div class="container">
<h1 class="logo"><a href="index.html">Brand</a></h1>
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="#">Latest news</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About us</a></li>
</ul>
</div>
<!--header ends-->
</body>
</html>
