The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Fixed Width Box Inside Liquid Width Box – Help Needed Re: Fixed Width Box Inside Liquid Width Box – Help Needed


I was trying to keep the example as simplistic as possible, but I should have included a few more details. The problem is, at design time, I don’t know how big the inner box is going to be. It could be a table that will only compress down so far, it could be an image with a diagram on it that extends out past the right hand side of the screen. In the case of a table, depending on the data in each field that comes back from the database, the minimum width can change. Same thing with images based on how complex the diagrams are.

With a table, the right hand edge of the outer table will stop contracting when it reaches the edge of the inner table or image or whatever is inside it, even though I haven’t specified the minimum width of the outer table.

With a div, I’m trying to recreate the same behavior. I need the outer box to contract until it reaches the edges of the inner box, at which point it should stop contracting.

Any way to do this using css?