Hi Rory,
As far as I know, you can't achieve that using only CSS, maybe you should
consider using JS.
Also, I noticed a problem with your HTML, you have a <p> inside a <span>.
Drop the <p> and set the span to display:block with something like this:
.photo_and_caption span {display: block;}
You may also want to consider using max-width and min-width for both the image
and the span.
Best,
Germán
On Jan 20, 2011, at 9:56 PM, Rory Bernstein wrote:
> I have a div that has a photo with a caption under it. The div is floated
> left so that a block of text can wrap around it:
> http://mcgivney.ehclients.com/press/
>
> But, I can't set a fixed width to the div with the photo because this is in a
> CMS and people can upload photos of different sizes. So, is there some way to
> always make the box as wide as the photo and not wider? I'd like the caption
> to wrap around in the box under the photo, but not be wider than the photo.
>
>
> ______________________________________________________________________
> css-discuss [[email protected]]
> http://www.css-discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/
> List policies -- http://css-discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Germán Martínez, UX Designer
http://martinez.pe
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/