如何将图标放在图片和段落的右边?

时间:2018-06-24 16:34:50

标签: css

我正在使用Bootstrap CSS。如何使用CSS进行样式设置:

我已经使用了此内容。这就是我得到的结果

html

<div class="container">
<img class="post-thumb" src="https://image.ibb.co/gmbNQT/matthew.png" alt="matthew">
<ul>
    <li>
       <a href="https://github.com/ankul007" target="_blank">
          <i class="fa fa-github-square" style="font-size:48px;color:purple"></i>
       </a>
    </li>
    .
    .
</ul>
<p class="post-content" >...........</p>
</div>

使用此CSS

.post-thumb {
    float: left;
    border-radius: 50%;
    display: inline-block;
    height: 300px;
    widows: 300px;
}

li {
    list-style-type: none;
    display: inline-block;
    margin-right: 30px;
    padding-top: 4px;
    text-align: center;
}
.post-content {
    margin-left: 350px;
    text-align: justify;
}

1 个答案:

答案 0 :(得分:0)

将图标和图像都放在一个父对象中,并向左浮动:

.post-thumb {
  float: left;
}

.post-thumb img {
  border-radius: 50%;
  display: inline-block;
  height: 300px;
  widows: 300px;
}

.post-thumb li {
  list-style-type: none;
  display: inline-block;
  margin-right: 30px;
  padding-top: 4px;
  text-align: center;
  font-size: 48px;
}
.post-content {
  margin-left: 350px;
  text-align: justify;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
  <figure class="post-thumb">
    <img src="https://image.ibb.co/gmbNQT/matthew.png" alt="matthew">
    <ul>
      <li>
        <a href="https://github.com/ankul007" target="_blank">
          <i class="fa fa-github-square"></i>
        </a>
      </li>
      <li>
        <a href="https://github.com/ankul007" target="_blank">
          <i class="fa fa-facebook-square"></i>
        </a>
      </li>
      <li>
        <a href="https://github.com/ankul007" target="_blank">
          <i class="fa fa-twitter-square"></i>
        </a>
      </li>
    </ul>
  </figure>
  <p class="post-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto culpa eaque a laboriosam mollitia nulla tempora ab in autem doloremque praesentium, facilis, assumenda incidunt earum delectus. Sequi suscipit ad voluptates.</p>
</div>

预览

this page