Image captions: caption width to match image width

What I’m trying to do

I’m trying to use the plugin Image captions. However, the caption takes up the whole line width making it impossible for other images to fit in the same line.

I want the caption to match the image width.

Things I have tried

Tried targeting image-captions-figure and image-captions-caption with stackoverflow solutions like so:

.image-captions-figure {
    display: table;
  }
  
image-captions-caption {
    display: table-caption;
    caption-side: bottom;
  }

Didn’t work. Does anybody have a solution? Thank you in advance!

Got it working with this code:

figure {
  display: table !important;
  margin: 0 !important;
}

figcaption {
  display: table-caption !important;
  caption-side: bottom !important;
}

However, images are still in two seperate lines:

What can I do to let them appear in the same line like so?

Thanks again!

@m.scheminger you don’t need the CSS snippet, you just need to update the plugin - the issue you’re experiencing was fixed last week:

Regarding images in a row - the CSS doesn’t do that yet but I’ll have a look at it.

1 Like

@m.scheminger inline images (same line) are now fixed in v1.1.1.

1 Like

Thanks! Updated, but doesn’t seem to work:

With caption:

Without caption:

Thanks again!

Just make sure you’re on 1.1.1, and don’t forget to delete your old snippet :wink:

Works like a charm! Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.