<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
*{margin: 0;padding: 0;}
.box2{width: 100%;height: 1007px;background-color: pink;margin-top: -0px;}
.box3:nth-child(odd){width: 100%;height: 100%;background-color: seagreen;}
.box3:nth-child(even){width: 100%;height: 100%;background-color: fuchsia;}
</style>
</head>
<body >
<div style="width: 100%;height: 1007px;overflow: hidden;">
<div class="box2">
<div class="box3">1</div>
<div class="box3">2</div>
<div class="box3">3</div>
<div class="box3">4</div>
<div class="box3">5</div>
</div>
</div>
</body>
</html>
上面的代码没有什么问题。
当去掉最外层的 div 或者 overflow:hidden;属性,在浏览器中检查然后设置 .box2 盒子的 margin-top 为 -1007px(第二个 .box3 )、-2014px(第三个 .box3 ......,这时候刷新页面,页面停留在了设置值的这一面,没有还原,谷歌浏览器出现这个问题了,Firefox没出现,求解!!!!!!!!!!!!!!!!!
经测试没有那种情况