> > I have a block that contains dynamically
> generated text, and an image.
> > I would like the width of this block to be
> determined by its textual
> > contents, and the image scaled to fit that
> width. Any ideas?
> >
> > Nicolas
> 
> img { width:100%; }
> 
> C Montoya

No, it doesn't work within a table-cell, as I mentioned in my previous
post (before the part quoted above).

<div id="sidebar">
<img ...>
blah blah blah
</div>


#sidebar { display: table-cell ; }
img { width: 100% ; }


To determine the width of the sidebar, the browser must first
determine the width of its contents. The image is scaled with respect
to the containing block, i.e. in my case the whole window. The sidebar
width is then adjusted to enclose this contents. At least in Opera
8.50 -- I don't test other browsers until I get it right with this one.

I would like to say: compute the sidebar width based solely on the
text content (blah blah blah), temporarily ignoring the image; then,
scale the image to fit this computed width.
Is it possible?

I have tried to insert a div around the image and set that div's and
the image's widths to various values. I got all sorts of weird results
but not what I wanted.

Nicolas
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to