当子div超出父级高度时

当子div超出父级高度时

本文介绍了当子div超出父级高度时,如何使子div可滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个子div,以行-列模式嵌套在父div中:父是一列,子是行。

I have 2 child divs nested in a parent div in row-column pattern: the parent is a column, and the children are rows.

上层子div的高度可变,但保证小于父div的高度。

The upper child div is of variable height, but is guaranteed to be less than the height of the parent div.

下一个子div的高度也可变。在某些情况下,子div的高度会使较低的子div超过父级。在这种情况下,我需要使下div可滚动。请注意,我只希望下div滚动,而不是整个父div。

The lower child div is also of variable height. In some cases, the heights of the child divs will make the lower child div exceed the parent. In this case, I need to make the lower div scrollable. Note that I want only the lower div to be scrollable, not the whole parent div.

我该如何处理?

有关案例示例,请参见附件jsfiddle:

这篇关于当子div超出父级高度时,如何使子div可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:17