Variable width div

Is there a way in CSS to create a variable width div? I have a div that will hold dynamically generated content. It may have 2 columns of images or it might have 4 columns of images. Is there a way to get it to resize to the width of it’s contents? If I do not specify an exact width, it sizes to the width of the browser viewport, regardless of it’s contents. Any ideas?

You could make the width shrink to fit by either making it display:inline-block, display:table-cell; or floating it :). Of course, each has the downfalls and other catering issues (which I’m assuming you already know how :))

You could set a min/max width on the container of those columns…but ultimately it isn’t that great for a dynamic situation just because you would have to manually specify how many columns…a multi column module is available in CSS3 though support is flimsy with only vendor extension testing in webkit/gecko :slight_smile:

I hope I helped and I didn’t sound like a rambling idiot (work+college semester finals=my brain dead :p)