I have a fluid width container DIV.
Within this I have 4 DIVs all 300px x 250px...
-
in jQuery
you might target the Parent directly.
THIS IS USEFUL IF YOU DO NOT KNOW EXACTLY HOW MANY CHILDREN WILL BE
ADDED DYNAMICALLY or IF YOU JUST CAN'T FIGURE OUT THEIR NUMBER.
var tWidth=0;
$('.children').each(function(i,e){
tWidth += $(e).width();
///Example: If the Children have a padding-left of 10px;..
//You could do instead:
tWidth += ($(e).width()+10);
})
$('#parent').css('width',tWidth);
This will let the parent
grow horizontally as the children
are beng added.
NOTE: This assumes that the '.children'
have a width
and Height
Set
Hope that Helps.