Linda Dunn <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a page posted here...
>
> http://www.seafoodlab.cmast.ncsu.edu/aboutus.html
>
> ...in which I am playing with the idea of making a div with class
> "photobox" for photos (the black and white one on the left) which will
> contain a photo caption.
...
> This works great so far for this one picture, but the problem is that I
> have to define the width of the div based on the photosize. So, the
> photos will either have to all be the same width, or I'll have to
> creative various photoboxes for various photo sizes.
>
> Is there anyway to have the div stretch automatically to accommodate
> photo size (with the caption underneath, since the img is defined as a
> block level element) that doesn't involve javascript or the like? I
> really like doing the captions this way rather than as part of the
> image, for obvious reasons.
Unfortunately, no. I have a setup something like this on one of my
sites; my solution was to use a style="" attribute on each <div>:
<div class="photobox" style="width: 300px">
<img src="..." alt="" />
Caption here
</div>
Since the width is intimately tied to a particular image, I would
argue that this is a justified use of a presentational attribute, but
I'm sure some subscribers would disagree.
--
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker
______________________________________________________________________
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/