471,605 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Div Dynamic Size

101 100+
Hi,

I have a Div of Height:285px used for a scrolling table.

I want to control the size of div dynamically on the basis of record if the table has 20+ records it show full height of the div (285px) but if it have less then 20 record the size of Div decreases acordingly..... like it have 10 records the height reduced to 150px etc..


Please help how to implement this in both browsers mozilla & IE.


Regards,
Nov 17 '07 #1
4 13499
realin
254 100+
Hi,

I have a Div of Height:285px used for a scrolling table.

I want to control the size of div dynamically on the basis of record if the table has 20+ records it show full height of the div (285px) but if it have less then 20 record the size of Div decreases acordingly..... like it have 10 records the height reduced to 150px etc..


Please help how to implement this in both browsers mozilla & IE.


Regards,

my solution may suck big time, but u can still give a try since u got no replies :p
I am really a loser in CSS but if i were in ur boots, i would have given a pseudo height or no height to the div.. now when the records are fetched the height is automatically adjusted..

Alternatively, you can try this tag in CSS
Expand|Select|Wrap|Line Numbers
  1. Overflow:scroll 
  2. or 
  3. overflow:auto;
hope this helps u a bit atleast.

cheers !!
Nov 17 '07 #2
drhowarddrfine
7,435 Expert 4TB
Not overflow:auto but height:auto will work. Overflow will work but that may cause other problems later since it's used to control elements that can flow out of an element, like floated elements.
Nov 18 '07 #3
buntyindia
101 100+
Not overflow:auto but height:auto will work. Overflow will work but that may cause other problems later since it's used to control elements that can flow out of an element, like floated elements.
drhowarddrfine, i have to maintain minimum height of 285px if records are more then 20. Height:auto works good for less records but when records are more then 20 it is increasing the height as well.

How cani maintain height ?
Nov 18 '07 #4
drhowarddrfine
7,435 Expert 4TB
In that case:
{
height:150px;
min-height:150px;
}

You need both because min-height only works in modern browsers and not Internet Explorer, but IE treats height like min-height and ignores min-height. (Stupid, eh?)
Nov 18 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Scott Lyons | last post: by
5 posts views Thread by meyousikmann | last post: by
3 posts views Thread by MikeY | last post: by
6 posts views Thread by Materialised | last post: by
3 posts views Thread by Stephen Gennard | last post: by
6 posts views Thread by MikeY | last post: by
2 posts views Thread by Luis Arvayo | last post: by
13 posts views Thread by jimjim | last post: by
7 posts views Thread by Joey | last post: by
13 posts views Thread by coosa | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.