Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-08-30 00:36:22
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
CSS or PHP question - floated div containing article image & caption
floating an article image wrapped in a div, that’s all good – the div automatically takes the width of its contained image, and body text flows around it…
but, using upm_img to insert a caption under the image, the div stretches to accommodate the caption text… (in primary browser, FF)
I don’t want to set a width on the article image div (it changes) but I do want to force the caption paragraph to ‘take the width’ of the image
job for PHP? or can CSS do this some how some way?
dummy code:
<code><div class=“article-image”>
<img src=”/champ.jpg” width=“200” height=“125” />
<p>The Bonobo (Pan paniscus), until recently usually called the Pygmy Chimpanzee and less often the Dwarf or Gracile Chimpanzee, is one of the two species comprising the chimpanzee genus, Pan. The other species in genus Pan is Pan troglodytes, or the Common Chimpanzee. </p>
</div></code>
Offline
Re: CSS or PHP question - floated div containing article image & caption
I had a similar problem recently, but I just attached an inline style (cringe!) to the div for width. It wasn’t ideal, and maybe there’s a better way, but it was late :). It seems to have taken care of the problem of the div expanding to 100%, even when it was floated:
<code>
<div id=“article-image” style=“width: <txp:upm_img_full_width />px”>
<txp:upm_article_image />
<p><txp:upm_img_caption /></p>
</div>
</code>
Offline
#3 2006-08-30 04:52:17
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: CSS or PHP question - floated div containing article image & caption
simple and effective – thanks!
Offline