我有以下代码:
body {
height: 100vh;
margin: 0px;
margin-top: 0px;
flex-direction: column;
background-color: rgb(41, 11, 22);
}
nav {
color: white;
background-color: rgb(214, 50, 50);
height: 10vh;
}Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index.css">
<title>Navbar Animations</title>
</head>
<body>
<nav>
<p>This is a test</p>
</nav>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
但最终的结果是这样的:
问题是:我如何消除顶部的差距?