How to make div not larger than its contents?

I have a layout similar to:
<div>
    <table>
    </table>
</div>
I would like for the div to only expand to as wide as my table becomes.


Best Answer:


The solution is to set your div to display: inline-block.

http://stackoverflow.com/questions/450903/how-to-make-div-not-larger-than-its-contents?answertab=votes#tab-top