On 2008-02-07, Alex K <al*********@gmail.comwrote:
Does anyone know how to make a div take the width of what it contains?
NOT the width of what contains it. This is usefull when we don't know
the size of the content in advance. Thank you so much.
Make it float: left (or right), display: table-cell, display: table, or
display: inline-block.
Of those only the first is reliable cross-browser.
Judging by the Subject line your next question is going to be how do I
centre this shrink-to-fit container. Unfortunately if you chose float
you can't.
If you need a centered shrink-to-fit block that also works in IE, the
only option is HTML tables.