Home How to make div not larger than its contents?

# How to make div not larger than its contents?

user5258
1#
user5258 Published in September 19, 2018, 11:07 am

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.

• the effect is called "shrinkwrapping", and as answered there's a couple of ways to do this (float, inline, min/max-width) all of which have side-effects to choose from – annakata Jan 16 '09 at 16:32