我如何在fontawesome图标附近定位文本?

时间:2017-12-31 14:30:14

标签: html position font-awesome

我有推文列表,字体很棒ico。如何在屏幕截图附近的图标附近放置文字?

截图: enter image description here

如果我使用下面的html,我的图标下面有文字。

<ul class="tweets-list text-left">
                        <li>
                            <div class="icon">
                                <i class="fa fa-twitter" aria-hidden="true"></i>
                            </div>
                            <div class="text">
                                <p>Check Out Dtbaker's @Arduino Sales Notification #System
                                    http://t.co/ WBFKIWHJ</p>
                                <span>3 days ago</span>
                            </div>
                        </li>
                    </ul>

1 个答案:

答案 0 :(得分:0)

Belial这是满足您要求的最简单方式,因此您的图标将与文本水平对齐,如果不需要,您可以删除ul和li。让我知道如果不想使用表,我会找到另一种解决方案。

<table>
<tr>
  <ul class="tweets-list text-left">
    <li>
      <td>
        <div class="icon">
          <i class="fa fa-twitter" aria-hidden="true"></i>
        </div>
      </td>
      <td>
        <div class="text">
          <p>Check Out Dtbaker's @Arduino Sales Notification #System
            http://t.co/ WBFKIWHJ</p>
          <span>3 days ago</span>
        </div>
      </td>
    </li>
  </ul>
</tr>
</table>  

编辑12/31

&#13;
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">

<div class="container">
  <div class="row justify-content-md-center">
    <div class="col">
      <div class="icon">
        <img width="50" src="http://icons.iconarchive.com/icons/uiconstock/socialmedia/512/Twitter-icon.png"/>
      </div>
    </div>
    <div class="col-md-auto">
      <div class="text">
        <p>Check Out Dtbaker's @Arduino Sales Notification #System
          http://t.co/ WBFKIWHJ</p>
        <span>3 days ago</span>
      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

jsfiddle :: https://jsfiddle.net/ufy6t9kd/