【问题标题】:Scroll - use the page/browser scroll bar to scroll a specific div element only滚动 - 使用页面/浏览器滚动条仅滚动特定的 div 元素
【发布时间】:2011-02-06 08:40:33
【问题描述】:

问题:我有以下布局:

<div class="container">
    <div class="filters1">
    </div>
    <div class="filters1">
    </div>
    <div class="stream">
          <div class="item"/>
          <div class="item"/>
          <div class="item"/>.......
    </div>
</div>

我希望页面有标准的浏览器滚动条,但它会滚动 div only

我尝试将 filter1 div 定义为 position:fixed。但这会导致一些跨浏览器问题和调整大小问题。 (需要 chrome css hacks 不谈 IE7)

有没有我可以使用的标准解决方案,各种搜索都没有帮助...

谢谢

【问题讨论】:

    标签: html css layout scroll resize


    【解决方案1】:

    你所说的“固定”是指“位置:固定”还是你给它一个固定的宽度和长度? (我不明白为什么后一种选择可能会有如此困难的渲染问题)。 试试

    .stream {
    width: XXpx;  /*put your width here*/
    height: XXpx; /*put height here*/
    overflow:scroll;
    }
    

    编辑:抱歉误读了这个问题,你想要整个页面都有滚动条还是只有 DIV .stream?

    【讨论】:

    • 谢谢,引用:“固定”是指“位置:固定”--是的,我确实引用了:您是否希望整个页面都有滚动-我希望整个页面都有一个滚动,只会滚动“流”div
    猜你喜欢
    • 2011-10-16
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多