.oO(John Elftmann)
Quote:
I frequently have images on press release pages. The images vary in
width, and usually have a cut-line/caption and are floated right. |
I do the same on one of my pages. The images are surrounded by a div-
container, so I'm able to put a caption beneath the image and float the
entire thing around.
Quote:
I
would like to create a style to format the div that and stretch or
shrink to the appropriate width. Is there any way of doing this? |
I use a server-side script for this (PHP). It gets the image size from
the file and applies it as inline-CSS to my image container.
OK, to be more precise, the code is generated from an XML document and
first looks something like this:
<div class="image" style="width: ::width::imagename::">
<img src="..." alt="...">
<p>caption</p>
</div>
The ::width::imagename:: is then replaced by PHP with the width of the
image.
Quote:
Specifying a div width of zero appears to work, but is it the right way
of doing it? |
I don't think so.
Micha