I have a text with an image in the end. If there is no space for the text and image, the image should never go alone on the second row. I made this with white-space: nowrap; combining the last word and the image. The problem is that hovering the image triggers the hover on the text. I am trying to figure out how to do avoid this. Here is my code:
html:
<p class="parent">
<span>This is a long word This is a long word This </span>
<span class="nowrap">long<img src="http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_b.jpg"
style="width:102px;height:80px"/>
</span>
</p>
css:
.parent:hover {
text-decoration: underline;
}
.nowrap
{
white-space: nowrap;
}
jsfiddle: http://jsfiddle.net/5pbk9djp/27/
I want to do this with only css. You can add additional classes and change the structure of the html as long as the icon does not go on a second row without a text.
Hovering the image should not underline the text
spanso thatimgwill be excluded