JSFiddle - React, Tailwind, and code Playground
HTML
<p><img src="http://static.jsconf.us/promotejshs.png" />Ruby text is a short annotation for some base text. It’s typically used to give pronunciation guidance in a phonetic script for kanji in Chinese, Japanese, and Korean (CJK) languages. It’s named after an old printers’ term for the very small size of 5.5 points.<img src="http://static.jsconf.us/promotejshs.png" />Ruby text is a short annotation for some base text. It’s typically used to give pronunciation guidance in a phonetic script for kanji in Chinese, Japanese, and Korean (CJK) languages. It’s named after an old printers’ term for the very small size of 5.5 points.</p>
CSS
.floatleft{float:left}
.floatright{float:right}
img{margin:5px}
JavaScript
$('p img:nth-child(odd)').addClass('floatleft');
$('p img:nth-child(even)').addClass('floatright');