Por que o css cria esse espaço em branco entre o header e a section, se estou aplicando margin-top apenas na div"card-container" dentro da section?
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
height: 100%;
font-family: 'Roboto';
}
header {
display: flex;
justify-content: space-between;
align-items: center;
height: 85px;
background-color: gray;
}
header h1 {
margin-left: 30px;
}
nav {
margin-right: 30px;
}
nav ul {
display: flex;
gap: 25px;
list-style: none;
font-size: 18px;
text-align: center;
}
nav ul li:hover {
color: #fff;
cursor: pointer;
}
.content {
background-color: blue;
}
.card-container {
display: flex;
justify-content: space-between;
width: 800px;
height: 800px;
margin-top: 15px;
}
.cards {
width: 120px;
height: 150px;
border: 1px solid black;
border-radius: 5px;
text-align: center;
background-color: cornflowerblue;
padding-top: 50px;
}
<!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>
</head>
<body>
<main>
<header>
<h1>Teste</h1>
<nav>
<ul>
<li>Home</li>
<li>Images</li>
<li>Contact</li>
</ul>
</nav>
</header>
<section class="content">
<div class="card-container">
<div class="cards">Texto 1</div>
<div class="cards">Texto 2</div>
<div class="cards">Texto 3</div>
</div>
</section>
</main>
</body>
</html>
margen
na classe "card-container", tenta remover ou ajustar isso. não relativo ao problema mas não deu pra deixar de notar, "Testo" é um typo certo? :)