Glen Lipka wrote: > I made a sample page to demonstrate the problem. > http://www.commadot.com/jquery/simple.htm > > I want to wrap a div around another div. The second DIV is of unknown > height/width and may be positioned left or center. The first > div must wrap TIGHT around the contents of the second DIV. > It can't expand 100%. > The reason is that I am positioning something absolutely on top of > unknown content. I therefore need the top left point of the unknown > content for positioning reference.
The second part of your message and something in your page made me unclear about what you really want to achieve, anyway... You mentioned a table and indeed I believe it solves your problem (why do you say it don't work in the left aligned case?) A table with a /single/ cell and no specified width usually shrink-wraps its content. And the whole table can be either left-aligned or centered (with margin: 0 auto, same as for centering block elements.) Difficulties arise if you want to avoid the use of a table, which is semantically incorrect. You can use display:table and display:table-cell, for browsers supporting them. This unfortunately leaves out IE. Another way to shrink-wrap content that is at least partially supported by IE is display:inline-block (and an "inline-block" can be either left-aligned or centered.) Unfortunately display:inline-block is not supported by Firefox at the moment (it will soon be.) You could combine the two things, using hacks to serve different declarations to different browsers (but I believe this is going to be more complicated than useful), you can have a look at some tests I did about this [1], [2]. Hth, Bruno [1] http://www.brunildo.org/test/shrink_center_3.html [2] http://www.brunildo.org/test/shrink-to-fit.html -- Bruno Fassino http://www.brunildo.org/test ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/