CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 31st, 2003, 05:30 AM
phlashlock phlashlock is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Anacortes, WA, USA
Posts: 5 phlashlock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old September 1st, 2003, 12:52 AM
xdhxy xdhxy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 76 xdhxy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 14 sec
Reputation Power: 5
not a very good solution but you can use a nested table there with width set to 1 to hold the image and caption.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS: Control width of div with specific child element


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway