html - margin :0 auto; width:1024; causes horizontal visible document reflow onload, 为什么?

标签 html css reflow

我可以在多个不同设计的网站上重现这个问题。 不幸的是,我无法在 jsfiddle 上重现它,因为它没有全屏显示。

在这两种情况下,都有一个 body 或 div 元素,内容如下:

<body style="display: block; margin: 0 auto; width: 1024px; min-width:1024px; max-width:1024px;>

并且页面在 200 毫秒后(在 onload 事件附近的某处)得到可见的回流。使用自动边距时水平回流的原因是什么?

例子:

此页面有回流: http://www.numbeo.com/common/form.jsp?country=United+States&city=San+Diego%2C+CA&returnUrl=%2Fcost-of-living%2Fcity_result.jsp%3Fcountry%3DUnited%2BStates%26city%3DSan%2BDiego%252C%2BCA

以下没有它: http://www.numbeo.com/cost-of-living/calculator.jsp

最佳答案

尝试删除 Facebook/tweeter 栏,看看这种情况是否仍然发生......然后你可以从那里开始。

关于html - margin :0 auto; width:1024; causes horizontal visible document reflow onload, 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22684698/

相关文章:

javascript - 图像预览无法正常工作

javascript - 使用具有可编辑网站的 iframe

javascript - jQuery Slider localScroll 和 Cycle 一起运行 - 不工作

html - Overflow-y :scroll is not working, 文本超出div

javascript - 在不同的 DOM 元素中组合/批量更新多个 CSS 以减少回流/重绘?

javascript - 访问布局信息也会导致浏览器重排吗?

php - 为什么 css 不影响我的 PHP 页面?

html - 如何根据窗口宽度调整菜单宽度

javascript - 将范围属性绑定(bind)到 CSS 属性的不同方法?

javascript - 回流和重绘(repaint)的替代方案