文档正文溢出隐藏的问题
从这个问题得到正确答案后,我遇到了另一个问题 - 添加margin:0em auto;
添加到我的页面将导致页面“跳跃”
.align-center-public {
width:1000px;
margin:0em auto;
overflow:hidden;
}
<div id="container">
<div class="align-center-public">
<p style="width:800px; text-align:center; border:1px solid #000;"><a href="#">Please scroll down until you see the click button</a></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<div><a href="#" class="get-photo">click here</a></div>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
</div>
</div>
我该如何解决此问题?
这是再次的链接。
After getting the right answer from this question, I am having another problem - adding margin:0em auto;
to my page will cause the page 'jumpy'
.align-center-public {
width:1000px;
margin:0em auto;
overflow:hidden;
}
<div id="container">
<div class="align-center-public">
<p style="width:800px; text-align:center; border:1px solid #000;"><a href="#">Please scroll down until you see the click button</a></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
<div><a href="#" class="get-photo">click here</a></div>
<p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
</div>
</div>
How can I fix this?
Here is the link again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
编辑
并且:
现在我注意到这显然就是您所需要的。
http://jfcoder.com/test/pooh.html
防止页面在滚动条消失,需要适当填充
BODY
。对于每个浏览器来说,这很可能是不同的值。以上我仅在 FF6、IE8/9 和 Chrome 最新版本中进行了测试。EDIT
And:
And now I'm noticing that this apparently is all you need.
http://jfcoder.com/test/pooh.html
To keep the page from correcting when the scrollbars disappear, you need to pad the
BODY
appropriately. This is more than likely a different value for each browser. The above I have tested in FF6, IE8/9 and Chrome latest only.尝试纯javascript...最好的“body”,而不是尝试使用“html”是错误。
Try a javascript pure... best 'body', not try use 'html' is bug.
发生这种情况是因为您在点击
点击此处
链接时将body
溢出hidden
更改为auto
。是否需要改变?It is happening because you are changing the
body
overflowhidden
toauto
on clicingclick here
link. Is it required to be changed?当视口水平缩小时,图像似乎也会重新显示,但只有在视口宽度缩小到某个设定宽度内之后才会重新显示。这就是你获得闪光灯的原因。如何在图像周围添加更多边框,以便您了解宽度是多少?
另外:您不必将图像放入
中 - 浏览器中的段落和图像处理之间可能存在一些交互。您可能想要删除
并看看会发生什么。
It seems, too, that the images are being redisplayed when the viewport shrinks horizontally, but only after the viewport width narrows to within some set width. That's why you are getting the flash. How about putting some more borders around the images so you can get an idea what that width is?
Also: you don't have to put the images in <p>s -- there might be some interaction between paragraph and image processing in the browser. You might want to remove the <p>s and see what happens.