Home How to make div not larger than its contents?
Reply: 0

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.

share|improve this question
  • 79
    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

34 Answers 34

active oldest votes
1 2 next
up vote 36 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.497883 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO