html - Keep last word and image on same line -
with css, there way break both last word , image new line @ narrower width?
http://jsfiddle.net/2koc2deo/3/
.text-two { width: 125px; } .text { font-size: 16px; }
<div class="text text-one"> <p><a href="#">customer service <img src="http://lorempixel.com/15/15/" alt=""></a> </div> <div class="text text-two"> <p><a href="#">customer service <img src="http://lorempixel.com/15/15/" alt=""></a> </div>
i added negative right margin <a>
elements, match image width.
prevents images triggering line wrap.
line wrap if text doesn't fit.
this works best in contexts right overflow of container still visible.
.text { font-size: 16px; } .text-two { width: 118px; } .text { margin-right: -15px; }
<div class="text text-one"> <p><a href="#">customer service <img src="http://lorempixel.com/15/15/" alt=""></a></p> </div> <div class="text text-two"> <p><a href="#">customer service <img src="http://lorempixel.com/15/15/" alt=""></a></p> </div>
this solution inspired beauceron's answer "attach font icon last word in text string , prevent wrapping"
Comments
Post a Comment