html - '溢出 : scroll' on a child div when overflowing the parent

标签 html css overflow

http://i.stack.imgur.com/rU410.png

我希望图像是不言自明的。包含的 div 具有可变高度。产品列表可以扩展到此包含 div 之外 - 如果列表大于包含 div,我希望列表滚动。显然,应用 overflow: scroll to the containing div 滚动整个 div 而不仅仅是列表。我怎样才能做到这一点?

谢谢

最佳答案

给 child div position: absolute 应该可以解决您的问题:

子元素:

position: absolute;
top: 0px;
bottom: 0px;
overflow: scroll;
/* and so on */

父级:

position: relative;

关于html - '溢出 : scroll' on a child div when overflowing the parent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33648380/

相关文章:

html - 我应该如何在 HTML5 中标记测量单位? (厘米、克等)

javascript - 在 Javascript 中打印多个 html 文件的输出

jquery - 使用 jQuery 设置 "width: calc..."的所有供应商前缀版本?

javascript - 检测 CSS 中的内容溢出

c - C 中 va_list 可能存在缓冲区溢出漏洞?

html - 宽位置 :fixed element won't stay inside scrollable container

html - 无法右对齐分页div

php - 在 php 中设置 session 生命周期

php - 如何在 bootstrap,laravel blade 中为同一行中的元素赋予不同的颜色

html - 超大屏幕和导航