【问题标题】:Resizing and then scrolling browser window and position absolute调整大小然后滚动浏览器窗口和绝对位置
【发布时间】:2012-02-28 23:57:07
【问题描述】:

标签: css html


【解决方案1】:

我不确定我是否完全理解您想要的功能。

但据我了解,您想将 #maincontent 更改为 position:fixed。

http://jsfiddle.net/MY7fY/

#sideBar {
    left: 5px;
    overflow: auto;
    position: absolute;
    right: 5px;
    top: 0px;
    width: 235px;
    border: 1px solid black;
    height: 5000px; /*silly value just to ensure that scroll bar is visible*/
}

#mainContent
{
    position: fixed;
    right: 5px;
    top: 0px;
    bottom: 0px;
    left: 250px;
    overflow: auto;
    padding: 10px;
    border: 1px solid black;
}

【讨论】:

  • 感谢您的回复-我尝试了您建议的固定值,但它并没有完全达到我想要达到的效果-所以我在我的原始帖子中添加了一个屏幕截图来尝试说明什么正在进行。希望这会有所帮助。
【解决方案2】:

使用下面的css

body {
      height: 100%;
      padding: 0;
      margin: 0;
     }

#mainContent {
    height:100%;
    ...
    }

【讨论】:

    猜你喜欢
    • 2011-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-20
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多