Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

font-awesome aligning multi line text correctly

I have an icon with text to the right of it like so:

<p style="text-align: left;">
    <i class="fa fa-example-icon" style="margin-right: 20px;"></i> 
    Text that is multi-lined.
</p>

Which aligns text and the icon for the first line. For example,

|icon| Text that is multi-lined.

But when text goes to the next line it appears as so:

|icon| Text that is multi-lined and now
it actually comes to the next line.

I want:

 |icon| Text that is multi-lined and now
        it actually comes to the next line.

What is the best way to have the text completely aligned with multiple lines? I have some hacks but want to do it correctly.

like image 722
shell Avatar asked Nov 09 '22 21:11

shell


1 Answers

You may do it like this:

.parent{
  width: 150px;  
}
.parent, .text{
  overflow: hidden;  
}
.text{
  margin: 0;
}
.fa-example-icon{
 float: left;
  display: block;
}
<div class="parent" style="text-align: left;">
    <i class="fa fa-example-icon" style="margin-right: 20px;">Icon</i> 
    <p class="text">Text that is multi-lined. This is multi line text Text that is multi-lined. This is multi line text Text that is multi-lined. This is multi line text Text that is multi-lined. This is multi line text</p>
</div>
like image 73
Pmpr.ir Avatar answered Nov 15 '22 06:11

Pmpr.ir