I am currently designing a responsive webpage featuring images of people's faces placed next to descriptive text. At smaller screen widths, everything looks perfect. However, as the page widens, the text for one person starts next to the image of the previous person.
https://i.sstatic.net/tz2mJ.jpg
To address this issue, I need a way to ensure that the text aligns properly with the image it belongs to.
https://i.sstatic.net/phyMz.jpg
If you have any suggestions or solutions, please check out my JSFiddle here.
img {
float: left;
clear: both;
margin: 0 20px 20px 0;
}
<img src="https://placehold.it/300x300">
<h1>First person's name</h1>
<p>A few paras of text.</p>
<img src="https://placehold.it/300x300">
<h1>Second person's name</h1>
<p>A few paras of text.</p>
Please note that using clear: both
ensures that the images do not overlap in the layout.
EDIT: I am looking for a CSS-only solution without any additional markup to simplify content management for non-technical users using TinyMCE editor in our CMS.