
August 31st, 2003, 05:30 AM
|
|
Junior Member
|
|
Join Date: Aug 2003
Location: Anacortes, WA, USA
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
CSS: Control width of div with specific child element
This may be impossible, but I thought I would ask:
I am trying to set the width of a div element based on the size of an image that is within the div. Normally this isn't a problem, without a width being defined, the div will dynamically fit around the size of the image. However, I also have a text caption below the image in this same div and if the line goes longer than the width of the image than the div will be resized so that it doesn't fit so nicely around the image.
I don't want to define the width of the div because the image contained will vary in size.
I want to be able to specify that the div should only be as wide as the image and force the text to break and start new lines below rather than expanding the width of the div.
So i want to specify which child element controls the parent.
Is this possible in any way? If so, I'd love to know. Thanks in advance
being used for the photo caption here:
http://philitopia.net/aonline/index.html
|