Html 正在尝试将图像居中放置在导航栏中

Html 正在尝试将图像居中放置在导航栏中,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我有一个引导导航栏。我有三张照片。我想要一个向右拉,一个向左拉,一个在中间。我得到了左边和右边,不知道如何将最后一张图像居中。尝试使用CSS并将其包装在中,但它与其他图像形成了一条单独的线。 有没有我不知道的CSS/bootstrap/html技巧 <div class="nav navbar-inverse navbar-fixed-bottom"> <div class="container"> <img class="contactPicture pu

我有一个引导导航栏。我有三张照片。我想要一个向右拉,一个向左拉,一个在中间。我得到了左边和右边,不知道如何将最后一张图像居中。尝试使用CSS并将其包装在
中,但它与其他图像形成了一条单独的线。 有没有我不知道的CSS/bootstrap/html技巧

<div class="nav navbar-inverse navbar-fixed-bottom">
  <div class="container">
  <img class="contactPicture pull-center" src="img/gmailIcon.png">
           <img class="contactPicture pull-left" src="img/githubIcon.png">
      <img class="contactPicture pull-right" src="img/linkedinIcon.png">


  </div>
</div>

检查图像是否处于相对位置。你应该重新排序你的html吗

因此,不是:

<img class="contactPicture pull-center" src="img/gmailIcon.png">
<img class="contactPicture pull-left" src="img/githubIcon.png">
<img class="contactPicture pull-right" src="img/linkedinIcon.png">

你想要:

<img class="contactPicture pull-left" src="img/githubIcon.png">
<img class="contactPicture pull-center" src="img/gmailIcon.png">
<img class="contactPicture pull-right" src="img/linkedinIcon.png">


如果所有其他方法都失败了,您可以将其包装在一个容器中,这个容器可能会工作,也可能不会工作,这取决于您的css

我认为没有任何内置的方法可以做到这一点,所以您(很可能)必须自己定位它。这里有一个例子

请参阅代码片段

.footer img中心{
左:50%;
位置:绝对位置;
左边距:-25px;
}

由于引导中没有“拉中心”,因此可以保持标记不变,并将以下内容添加到CSS中:

.nav .container {text-align:center;}

好了,伙计们,想一想这个。把图像排成一行,排成一列。把麻烦的图像作为一个品牌。这是我的html

<div class="nav navbar-inverse navbar-fixed-bottom">
  <div class="container">
    <div class="row">
      <div class="col-md-4">
        <img class="contactPicture pull-left" src="img/githubIcon.png">
      </div>
        <div class="col-md-4">
        <a class="navbar-brand-gmail" href="#"><img class="contactPicture gmail" src="img/gmailIcon.png"></a>
      </div>
      <div class="col-md-4">
        <img class="contactPicture pull-right" src="img/linkedinIcon.png">
      </div>
    </div>    
  </div>
</div>

我唯一改变的是将padding top添加到零,因此它与其他图像一致。

将类
文本中心添加到
。container
注意:应该删除pull center。@RokoC.Buljan我说可能没有像引导本身那样的内置方式。
.navbar-brand-gmail {
   position: absolute;
width: 100%;
left: 0;
text-align: center;
  padding-top: 0;
margin: auto;}