Responsive Captions

I’m trying to create captions that are responsive with their accompanying images. I think this may be achievable by wrapping the image and caption in a div/span with the following css:

figure span{
display: inline-block;
position: relative;


but as a php/wordpress novice I’m not sure how edit cleanup.php (is this the correct file?) to do this. Advice much appreciated.