Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make div fixed in height but grows if content is bigger than height?

Tags:

html

css

Let's say I have a div to which I set height: 500px; in CSS, thus it's fixed in height.

The content of my page is generated automatically in JavaScript, thus sometimes it's bigger than 500px and it overflows the div border.

My question is: is it possible to have a fixed size (for example 500px) but when the div's content is greater than 500px, have the div growing bigger to contain that?

Thanks

like image 797
Masiar Avatar asked Dec 12 '11 11:12

Masiar


1 Answers

Try

min-height: 500px;
height:auto;

to set a minimum height.

For reference: http://www.w3schools.com/cssref/pr_dim_min-height.asp

like image 134
Jeremy McGee Avatar answered Oct 05 '22 10:10

Jeremy McGee