- This topic is empty.
April 21, 2015 at 5:14 am #200848ASIMandyParticipant
Searched all over for this one and I’m beginning to think it’s impossible!
I have a wordpress website where I post randomly sized images (they’re rarely the same size as the previous image) in blog posts, with the content text wrapping around it. I float the images left.
Thanks a ton in advance.
AndyApril 21, 2015 at 6:05 am #200850Paulie_DMember
Need to see the HTML involved.
If you’re using captions then, ideally, you should be using the
<figure> <img src=" etc" /> <figcaption> My Caption</figcaption> </figure>April 21, 2015 at 6:36 am #200858ASIMandyParticipant
Thanks for the response. I wasn’t using figure and figcaption elements. I’ve just had a play around with them in codepen and I can’t seem to control the width of the img within the figure though??
Here is my code. I want the caption to break onto the next line when it’s as wide as the image, but I’m not able to say how wide the image is.April 21, 2015 at 7:03 am #200868Paulie_DMember
Simple answer..you can’t exactly.
You need to have some width limitation that would cause the text to break….and that would apply to whatever element you are using, be it a figure / figcaption or whatever.
I get that you want the images to be a as big as possible so the only solution I can come up with is to use the figure/figcaption and position the figcaption absolutely on top of the image.
This will allow you to set the width to be no more that 100% width of the figure and the width of that can be set by the image.
- The forum ‘CSS’ is closed to new topics and replies.