*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: 'Poppins' , sans-serif;
}
header{
height: 10vh;
width: 90%;
margin: auto;
align-items: center;
display: flex;
}
nav {
flex:1;
background-color: darkorchid;
}
.nav-links {
display: flex;
justify-content: space-around;
list-style: none;
}
.nav-link {
color: #5f5f79;
font-size: 18px;
text-decoration: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="decorate.css">
<meta charset="utf-8">
<title>Hello world</title>
</head>
<body>
<header>
<nav>
<ul class = "nav-links">
<li ><a class="nav-link" href="#">education</a></li>
<li ><a class="nav-link" href="#">work</a></li>
<li ><a class="nav-link" href="#">certificates</a></li>
</ul>
</nav>
</div>
</header>
</body>
</html>
This outputs the expected results with the space between navigation links . whereas the below code has a different output when div is included.
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: 'Poppins' , sans-serif;
}
header{
height: 10vh;
width: 90%;
margin: auto;
align-items: center;
display: flex;
}
nav {
flex:1;
background-color: darkorchid;
}
.nav-links {
display: flex;
justify-content: space-around;
list-style: none;
}
.nav-link {
color: #5f5f79;
font-size: 18px;
text-decoration: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="decorate.css">
<meta charset="utf-8">
<title>Hello world</title>
</head>
<body>
<header>
<div class="container">
<nav>
<ul class = "nav-links">
<li ><a class="nav-link" href="#">education</a></li>
<li ><a class="nav-link" href="#">work</a></li>
<li ><a class="nav-link" href="#">certificates</a></li>
</ul>
</nav>
</div>
</div>
</header>
</body>
</html>
why does including the tag give a different output even when the div tag is not used in CSS . I am novice , so I might not be understanding some of the concepts in both HTML and CSS .