On Sep 12, 2007, at 9:11 AM, sandy wrote:

> Hi everyone.  I am trying to achieve an expanding caption box that  
> will
> go under an image, and will be the size of that image based on their
> parent div which would be based on the size of the image.
> [...]
>
>  <div id="image_and_caption">
>          <img src="<?php echo ROOT_PATH ?>images/image_2.jpg"
> alt="image_2" />
>          <div class="caption">
>                  Lorem ipsum dolor sit amet, consectetuer  
> adipiscing elit.
>                  <div class="caption_bot_left">
>                          <div class="caption_bot_right"></div>
>                  </div>
>          </div>
>  </div>
>
> [...]
>
> I was under the impression that if specified a margin-left, a
> margin-right, and set width to auto that the width would become the
> width of its parent (image_and_caption).
That is correct. Basically.

The question is: how does the width of the parent (image_and_caption)  
get computed ?
Is it a floated element or an absolute positioned element ? Your code  
snippet doesn't say.
In both those case, if no width is specified on that element  
(image_and_caption), the element is shrink-wrapped. But that shrink- 
wrapping depends on all the content of the element, including your  
image and text.

Another case where shrink-wrapping might occur is if the parent  
(image_and_caption) element is set to display:table.

If the width on the parent element _is_ specified, then there  
probably is another problem with your code.

In all cases, a sample page (clickable url) would be useful.



Philippe
---
Philippe Wittenbergh
<http://emps.l-c-n.com>




______________________________________________________________________
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/

Reply via email to