Keleth
08-04-2011, 11:39 PM
I have a div in which I have a number of floated divs, creating a number of rows within. The way its setup (using a few clears to arrange the layout the way I want), with height of the parent is up to the top of the last row, and expands the entire width of the page (as expected).
I'm trying to figure out if there is a way to get the div to fit exactly the content that's within it. Because of the way its setup, I can calculate the height/width (the number of rows and their width are determined by the user) and give the parent div a hard set height/width, but that's adding a step I'd rather avoid.
Anyone know of a way to get the div, given it has floading divs within it, to fit the content? Or am I going to have to hard code it?
Small note, I am aware of using a clear: both at the bottom to have the vertical content fit (if just slightly over), but I'm not aware of that fixing the horizontal fit, and I'm more curious if there is a method of getting an exact/nearly exact fit, rather then a close fit.
I'm trying to figure out if there is a way to get the div to fit exactly the content that's within it. Because of the way its setup, I can calculate the height/width (the number of rows and their width are determined by the user) and give the parent div a hard set height/width, but that's adding a step I'd rather avoid.
Anyone know of a way to get the div, given it has floading divs within it, to fit the content? Or am I going to have to hard code it?
Small note, I am aware of using a clear: both at the bottom to have the vertical content fit (if just slightly over), but I'm not aware of that fixing the horizontal fit, and I'm more curious if there is a method of getting an exact/nearly exact fit, rather then a close fit.