Set div to sibling's width

Hi! I’m trying to make a CMS carousel where a caption is set to the width of a dynamically sized photo, but I’m having trouble. Anyone know a good workaround?

Basically I want it like this:

Link (relevant part is in the homepage in the “art” carousel):