浏览器上的滚动条和div margin 0自动跳转 [英] scrollbar on browser and div margin 0 auto jumping
问题描述
我正在使用div#wrapper margin:0 auto
来居中div,但是在这个页面上有滚动条,但是当它转换到没有滚动的第二页时酒吧,它显示为跳动,因为我没有滚动条我猜。
< body>
< div id =wrap>
< div id =wrapper>
....
#wrapper {width:970px;保证金:0汽车; }
最好的解决方案是不会让它跳动?
我遇到过这几次,我发现的最好的办法是强制 Y滚动条即使在你的样式表中不需要使用它:
}这意味着页面上始终有一个正确的滚动条,但它将被启用/根据需要禁用,并阻止跳转。
i am using div#wrapper margin: 0 auto
to center the div, there is scroll bar on this page however when it transition to second page where there is no scroll bar, it appears as jumpy because there is no scroll bar i guess.
<body>
<div id="wrap">
<div id="wrapper">
....
#wrapper { width: 970px; margin: 0 auto; }
what would be the best solution for this not to make it jumpy?
I've run into this a few times, the best thing I've found is to force a Y scroll-bar on every page, even if it isn't needed using in your style sheet:
html { overflow-y: scroll; }
This will mean there is always a right scroll bar on the page, but it will be enabled/disabled as needed, and prevent the jump.
这篇关于浏览器上的滚动条和div margin 0自动跳转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!