Can someone help me understand why when I add padding to the "header div," the content overflows the div? For instance, if I set it to 60%, instead of limiting to within the div, it takes up 60% of the entire page. I thought that % would be applied based on the parent's height/width. Any explanations would be appreciated! Thank you :) check out this image for reference
*{
margin: 0;
text-decoration: none;
list-style: none;
}
header{
background-image: url("../img/stock-1.jpeg");
background-position: 50% 25%;
min-height: 650px;
height: 60vh;
}
header nav{
display: flex;
justify-content: space-between;
height: 60px;
}
header nav a img{
width: 15rem;
}
header nav ul{
display: flex;
justify-content: center;
align-items: center;
}
header nav ul li:nth-child(n + 2){
margin-left: 20px;
}
header nav ul li a{
color: black;
}
header div{
background-color: aqua;
display: flex;
padding-top: 60%;
flex-direction: column;
align-items: center;
}
<!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>Document</title>
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<header>
<nav>
<a href=""><img src="assets/img/logo_black.png" alt="Logo"></a>
<ul>
<li><a href="">Blog</a></li>
<li><a href="">Videos</a></li>
<li><a href="">Discover</a></li>
</ul>
</nav>
<div>
<h1>Explore new places and adventures</h1>
<input type="text" placeholder="Search for places...">
</div>
</header>
<main>
<section>
<h2>Latest posts</h2>
<article>
<img src="assets/img/last-posts-1.jpeg" alt="">
<h3>Climbing the Himalayas</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi earum neque libero officiis reprehenderit repudiandae placeat soluta deserunt harum qui. Fugit, in non repudiandae mollitia nemo tenetur explicabo a sequi?</p>
</article>
</section>
</main>
</body>
</html>
*filler text included due to excessive code*filler text included due to excessive code