I want to create responsive navigation bar in flexbox. The problem is facing is to align the bar in center of container. I tried justify-content:center and text-align:center while using these i found some empty space left before nav bar is not aligning center perfectly in mobile screens please review my code and help me!
Html document
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:200,300,400,700" rel="stylesheet"
type="text/css">
<link rel="stylesheet" href="style.css" />
<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>Document</title>
</head>
<body>
<div class="box">
<div>
<nav>
<ul>
<li>Home</li>
<li>Service</li>
<li>About</li>
</ul>
</nav>
</div>
</div>
</body>
</html>
Css styling
.box ul{
list-style: none;
border: 1px solid;
display: flex;
justify-content: space-between;
}
.box li{
border: 1px solid;
}
Screenshot of responsive navbar image in mobile view:
Screenshot of responsive navbar image in Desktop view: