Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line break between icon and text even with  ?

I can't figure out how to put a non breakable space between an icon and the corresponding text.

For example

<i class="bla"></i>&nbsp;someText

ignores the &nbsp; in lower screen resolutions and displays the text under the icon. Is there any other method to make sure that an icon and some text to the right is always in line, regardless of the available space?

Thanks in advance!

like image 499
Daniel Avatar asked Sep 27 '22 11:09

Daniel


1 Answers

Set a container and use the rule white-space

HTML

<div class="container"><i class="bla"></i>&nbsp;someText</div>

CSS

.container{
display: block;
white-space: nowrap;
}

DEMO HERE

Read more about white-space

https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

like image 116
Luís P. A. Avatar answered Oct 02 '22 16:10

Luís P. A.