Searched the web for weeks but can't find the answer that satisfies all my needs (only partial), help is very welcome.
What I want and have accomplished:
<figure class="left">
)And now I like to add those requirements:
<figure class="left" style="width:200px">
but only if there is no other way.Where I left:
figure {
display: inline
}
figcaption {
display: block
}
figure.left {
float: left
}
figure.right {
float: right
}
<p>This is a part of the text of the article and at this point a image is inserted at the left side
<figure class="left" style="width:250px">
<img src="image.png" alt="img txt">
<figcaption>image caption and a lot of text</figcaption>
</figure>
and the article text goes on and on so that it will wrap around the image</p>
(I left out the padding/margins and such to make it look better.)
Try the following css and look when you resize the browser, the text wrap on the image:
.left {
float: left;
border: 5px solid #BDBDBD;
background: #E0E0E0;
padding: 5px;
margin: 0px;
}
figcaption {
text-align: center;
}
Maybe this feels too html3 to you, but I found this answer:
http://www.sitepoint.com/forums/showthread.php?1049396-How-to-force-this-figcaption-element-to-respect-its-parent-s-width-boundaries
figure {
display: table;
}
figcaption {
display: table-caption;
caption-side: bottom;
}
I don't think this is forbidden by HTML5 or CSS3 and it certainly seems to work for me.
Leaving aside the responsive design requirements - I feel like that's a separate question to which I don't have a good CSS-only answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With