1

我无法在可滚动的 div 上方添加任何 HTML 元素,而没有他们将该 div 推离页面底部。这显然是一个 100% 的高度问题,但不确定如何解决。

http://codepen.io/establish/pen/lCGwn

HTML

<div class="container">

  <div class="stream page">
    <div>THIS IS A DIV</div>
    <div>THIS IS ANOTHER DIV</div>
    <div class="stream-content">
      <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut odio libero, posuere in tortor quis, malesuada ullamcorper ante. Morbi sed orci nisi.</h2>

      <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut odio libero, posuere in tortor quis, malesuada ullamcorper ante. Morbi sed orci nisi.</h2>

      <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut odio libero, posuere in tortor quis, malesuada ullamcorper ante. Morbi sed orci nisi.</h2>
    </div>
  </div>

  <div class="detail page">
  </div>

</div>

CSS

.container {
  background-color: pink;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0; 
}

.detail {
  background-color: blue;
  left: 425px;
}

.stream {
  background-color: green;
  width: 425px;
}

.stream-content { 
  overflow-y: scroll;
   height: 100%;
}
4

0 回答 0