How to set minimum height for a div?

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;

min-height:510px;

css has a min-height attribute


Here is d way through which you can set min height of a div

<div id="bb1" style="min-height:200px;>
    .....
</div>

or apply

#bb1{
    min-height:200px;
}

if you have used class

like

<div class="bb1"> 

in div then use

.bb1{
    min-height:200px;
}

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; }

Tags:

Css