In a Joomla (3.6.5) article I have an image with style: float:left
, with several h3 headings, each followed by some plain paragraph text.
Depending on the viewing screen width, which varies a lot, sometimes one of the h3 headings lines up at the bottom of, but still to the right of, the image and the following paragraph is underneath the image on the left. (see mockups)
What I am trying to achieve is to keep the h3 heading with the following first paragraph in the same way as MS Word's "keep with next" function.
I have no special CSS for this article and am not using ul or ol lists. There is only one column and one page, so page-break-avoid is not relevant. It is not a page-break issue.
I have tried wrapping the h3 and associated p tags in a container, but that makes no difference.
Image 1: current text wrapping
Image 2: the 'keep with next' text wrap I am wanting to achieve:
For what it's worth, the code is just:
<h3 style="margin-top: 0; line-height: 30px;">
<img src="images/image-file.jpg" alt="alt text" style="margin-right: 15px; margin-bottom: 5px; float: left;" />h3 heading
</h3>
<p>Some text<br />Some more text</p>
<h3>Another h3 heading</h3>
<p>The quick brown fox jumps over the lazy dog</p>
</h3>
<h3>Third h3 heading</h3>
<p>Last bit of text. Would like to keep previous h3 heading with this first line when wrapping around images</p>
Any suggestions gratefully received.