Pertaining to html, how do I make a div container grow with the content instead of manually defining a width and height.
-
The default behaviour for divs is to fill the entire available width. A few ways to override this:
- set
display: inline-block
(not IE-friendly)
- float it (with the side effect of, well, floating it)
- set
display: inline
(but that's almost never what you want)
- set
position: absolute
- hard-code a width (no dynamic width though)
As a last resort, consider javascript.