包含绝对定位元素的父级滚动条

jst*_*all 1 css

我有以下代码jsbin.当消息溢出包装器时,是否可以进行垂直滚动?谢谢!

Ami*_*mit 5

用这个css 演示替换你的css

#wrapper {
  position: relative;
  height: 400px;
  border: 1px solid #AAA;
  margin-bottom: 20px;
}

#list {
  position: absolute;
  bottom: 0;
  width: 100%;
  max-height:100%;
  overflow-y: auto;
}

.message {
  background-color: orange;
  padding: 10px;  
  border-bottom: 1px solid red;
}
Run Code Online (Sandbox Code Playgroud)