![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
On 2008-02-07, Alex K <alex.ksikes (AT) gmail (DOT) com> wrote: 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. |
#4
| |||
| |||
|
|
Perhaps OP will benefit from: http://netweaver.com.au/alt/shrinkTo...teringShrinkTo Fit.html |
#5
| |||
| |||
|
|
dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote in news:doraymeRidThis- 978BE2.08240508022008 (AT) news-vip ...ptusnet.com.au: [snip] Perhaps OP will benefit from: http://netweaver.com.au/alt/shrinkTo...teringShrinkTo Fit.html Oh is see a mistake. Silly me, what was I thinking when I used inline-box for IE. It should be inline-block, but I suppose that is the reason I added zoom:1; to the rule all in an effort to trigger hasLayout. Now that is done display:inline-box; should be display:inline-block; and since I don't recall if IE less then 6 needs zoom:1; or not I would leave that is as well since it's in a conditional comment. |
#6
| |||
| |||
|
|
In article <Xns9A3E76D7596E2BootNic (AT) bootnic (DOT) motzarella.org>, BootNic <bootnic.bounce (AT) gmail (DOT) com> wrote: dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote in news:doraymeRidThis- 978BE2.08240508022008 (AT) news-vip ...ptusnet.com.au: [snip] Perhaps OP will benefit from: http://netweaver.com.au/alt/shrinkTo...teringShrinkTo Fit.html Oh is see a mistake. Silly me, what was I thinking when I used inline-box for IE. It should be inline-block, but I suppose that is the reason I added zoom:1; to the rule all in an effort to trigger hasLayout. Now that is done display:inline-box; should be display:inline-block; and since I don't recall if IE less then 6 needs zoom:1; or not I would leave that is as well since it's in a conditional comment. I should have picked this one up myself. Perhaps at the time I regarded anything for IE as like a smelly rat, best left to professional pest inspectors. That's you, Bootnic! I have taken the opportunity to add a comment in the source for the page you refer to. It elevates you in a style that reminds me of the way Virgil used to describe his characters, especially heroes. See the Aeneid. You are now "the keen-eyed Bootnic". |
#7
| |||
| |||
|
|
Tis one more inline-box that needs to be changed to inline-block. On the URL you provided that describes my indiscretion. |
![]() |
| Thread Tools | |
| Display Modes | |
| |