I've been struggling for two days now trying to fix an issue with the alignment of images and captions on my Django application.
In my app, users can upload images, and I'm using figure and figcaption tags to display the image with a caption. However, I'm facing an issue where the caption width is wider than the image itself.
I'm looking for a solution to keep the image size constant while adjusting the caption width to match. I'm also utilizing Twitter-Bootstrap in my project. Any suggestions or advice would be greatly appreciated!
UPDATE: Here's the HTML template code and CSS:
<div class="span4 offset2">
{% if story.pic %}
<h2>Image</h2>
<figure width="{{story.pic.width_field}}">
<img class="image"src="{{ story.pic.url }}" width="{{story.pic.width_field}}" alt="some_image_alt_text"/>
{% if story.caption %}
<figcaption>
{{story.caption}}
</figcaption>
{% endif %}
</figure>
{% endif %}
</div>
image {height:auto;}
figure {margin:0; display:table;}
figcaption {display:table-row;
max-width: 30%;
font-weight: bold;}