Refti Refti - 1 year ago 72
CSS Question

Dynamic height for DIV

I have the following DIV

<div id="products">


height: 102px; width: 84%;
padding:5px; margin-bottom:8px;
border: 1px solid #EFEFEF;

Now inside the DIV, I am dynamically generating 4 links. But sometimes there could be more or less than 4 links. How can I change the CSS to dynamically resize the DIV according to its contents?

Answer Source

set height: auto; If you want to have minimum height to x then you can write

height:auto !important;        /* for IE as it does not support min-height */
height:30px;                   /* for IE as it does not support min-height */
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download