How to set minimum height for a div?
Solution 1:
CSS allows a "min-height" property. This can be used to set the minimum height of the div you're talking about.
#div-id { min-height: 100px; }
Solution 2:
Incase you want to set a minimum/maximum height and minimum/maximum width to a div
, CSS allows the specific feature.
To set the minimum width of the div
or any other class/id/element, use;
min-width: 150px;
To set the minimum height of the div
or any other class/id/element, use;
min-height: 300px;
Similarly for setting maximum width and height of a div
or any other class/id/element, use;
max-width: 600px;
max-height: 600px;
Important:
For your div
to expand freely in height and width after data is available for users; you will have to set the width/height to auto
immediately after you have set the min-width
or min-height
.
min-width: 300px;
width: auto;
min-height: 100px;
height: auto;
Solution 3:
min-height:510px;
css has a min-height attribute