【发布时间】:2021-12-28 23:53:34
【问题描述】:
我在 a 中添加的任何内容都会覆盖 css 重置并在网站右侧添加 1em 边距(底栏不显示,但如果您使用鼠标滚轮单击,则可以将其滑动到一侧) .
/*Reset*/
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body{
height: 100vh;
width: 100vw;
}
p {
margin:0;
margin-block-end: 0;
margin-block-start: 0;
}
header{
background-color: blueviolet;
}
section.sec1{
display: block;
background-image: url('assets/bg1.avif');
width: 100vw;
height: 100vh;
background-size: cover;
background-position: center;
}
section.sec2{
background-color: cornflowerblue;
}
section.sec3{
background-color: green;
}
section.sec4{
background-color: gold;
}
<!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">
<link rel="stylesheet" href="style.css">
<title>html page</title>
</head>
<body>
<header>
<p>header</p>
</header>
<section class="sec1">
<p>sec1</p>
</section>
<section class="sec2">
<p>sec2</p>
</section>
<section class="sec3">
<p>sec3</p>
</section>
<section class="sec4">
<p>sec4</p>
</section>
</body>
</html>
我该如何解决这个问题?谢谢。
PS:“bg1.avif”是 2158 x 1798px,但即使没有它,您也可以看到问题。
【问题讨论】:
-
我没有看到这个问题。所有
margin-block-end & start在我的浏览器中都位于0。