CSS Property:
max-height:

Result:

Change this DIV's max-height by clicking the radiobuttons on the left.

Overflowing content will be displayed outside of the DIV

This text is repeated so that the DIV will be large enough for the demonstration.

Change this DIV's max-height by clicking the radiobuttons on the left.

Overflowing content will be displayed outside of the DIV

This text is repeated so that the DIV will be large enough for the demonstration.

Change this DIV's max-height by clicking the radiobuttons on the left.

Overflowing content will be displayed outside of the DIV

This text is repeated so that the DIV will be large enough for the demonstration.

CSS Code:
div {
    height:auto;
max-height:none;
}
Click the property values above to see the result
W3Schools.com - Play it