Fontawesome icon prevent newline wrapping

falconbur picture falconbur · Feb 24, 2014 · Viewed 19.7k times · Source

how can I prevent a newline to be inserted between a fontawesome icon and the text that is near this icon ?

See the fiddle, I have a nbsp, but it is discarded.

In the example below, I don't want a wrap to ever occur between the icon and the word "first", but it can occur between "first" and "second". It doesn't work though, see the fiddle.

  <i class="fa fa-search"></i>&nbsp;first second

It is related to this question, but I can't seem to make it work:

Attach font icon to last word in text string and prevent from wrapping

Answer

jasonhansel picture jasonhansel · Aug 11, 2014

Add the CSS: .fa { display:inline; }

Demo fiddle.