I noticed that my browser can set a line break after the <img> , even if this image tag is followed by :
<p style="width: 12ex; font-family:monospace;"> 12345678 <img style="width: 2ex" src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/25px-Smiley.svg.png"> 123 </p>
The emoticon should be on the second line, because the image tag is followed by nbsp; . I can get this behavior to add <span> with white-space: nowrap :
<p style="width: 12ex; font-family:monospace;"> 12345678 <span style="white-space: nowrap"><img style="width: 2ex" src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/25px-Smiley.svg.png"> 123</span> </span> </p>
Is there a solution without adding an additional <span> ? For example: is there a CSS statement for <img> to prevent line breaks after it?
Note. CSS <p> should not be changed. I use it only to simulate a problem.
source share