在可滚动父元素外部显示div

时间:2016-03-24 00:13:26

标签: html css scroll overflow

我想在他的父元素上面显示一个div,它可以滚动(overflow:scroll)和相对定位(position:relative)。有任何想法吗?非常感谢你!



div{
  width: 100px;
  height: 100px;
  background: red;
  overflow-y: scroll;
  position: relative; /* position: static is not an option */
}
span{
  display: block;
  width: 50px;
  height: 50px;
  position: absolute;
  top: 70px;
  background: yellow;
}

<div>
  <span></span>
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案