I spent the past three hours trying to figure out how to properly caption floated images inside paragraphs. I found numerous websites covering the task of captioning images, but none of them were dealing with captioning an image inside a paragraph. The deal breaker here is the inability to have elements other than em>, strong>, img> and such within p>. Whats the best practice to handle image captions in paragraphs?
I prepared a jsfiddle: http://jsfiddle.net/cm94k/
Thank You
html used:
<h3>I want the red "kitten"-caption to be generated with html/css. (This one is in the image!)</h3>
<p>
eginning of the paragraph, but the end-tag is optional. Nevertheless, consistently including the end-tag is a good practice, and make certain types of automated processing easier. More importantly, it helps to make explicit
<img class="capimg" src="http://tinyurl.com/ppy7cuk" />
exactly where your paragraph really ends, which may differ quite significantly from where you as an author would have it. The ambiguity arises from the fact that HTML prescribes quite rigidly which elements may nest inside other elements. The only things that
</p>
css used:
p {
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3;
-moz-column-gap:2em; /* Firefox */
-webkit-column-gap:2em; /* Safari and Chrome */
column-gap:2em;
}
.capimg {
float: left;
width: 33%;
}