请问,在HTML中如何对最外层的container div去除外边距?
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="div1">
</div>
<div class="div2">
</div>
</div>
<style>
.container {
margin: 0;
width: 500px;
height: 500px;
background-color: aliceblue;
}
.div1 {
width: 100%;
height: calc(100vh - 22px);
background-color: antiquewhite;
}
.div2 {
width: 100%;
height: 22px;
background-color:aquamarine;
}
</style>
</body>
</html>
但是一直有一个外边距: