Bootstrap奇怪的网格对齐

时间:2016-12-08 12:54:29

标签: html css twitter-bootstrap

愿你们有些人解释我为什么我的引导网格表现得很奇怪?

最终结果必须如下图所示: enter image description here

但是当我编码并检查浏览器版本与psd版本时,我的不同......发生了什么?红色框来自我的浏览器视图(chrome)。

enter image description here

有任何线索吗?

.facts { color: #fff; background: linear-gradient(  rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url(https://s27.postimg.org/7kjcvsxc3/facts_bg.jpg) 0 0 no-repeat; background-size: cover; padding: 40px 0; width: 100%; min-height: 505px; }
.facts-content { text-align: center; }
.facts-content h3 { font-family: "Gotham-Book", sans-serif; font-size: 47px; line-height: 55px; padding: 0 5px; text-transform: uppercase; margin: 38px 0 41px 0; }
.facts-content h3 span { color: #00c0ff; }

.item h4 { font-family: "Gotham-Black", sans-serif; font-size: 40px; line-height: 49px; padding: 0 5px;  }
.item h4 > span { font-family: "Gotham-Light", sans-serif; }
.item p { font-family: "Lato-Regular", sans-serif; font-size: 16px; line-height: 22px; padding: 0 5px;  }
.item a { display: block; margin-bottom: 27px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<section class="facts">
  <div class="container">
    <div class="facts-content">
      <h3>some <span>facts</span> about us</h3>
      <div class="row">
        <div class="col-md-3 col-sm-3">
          <div class="item">
            <a href="#">
              <img src="https://s16.postimg.org/z29j3y5s1/ideas.png" width="124" height="124" title="someText" alt="someText">
            </a>
            <h4>14<span>&#37;</span></h4>
            <p>Proin hendrerit velit a lectus vel nibh tincidunt</p>
          </div>
          <!-- item -->
        </div>
        <!-- col-md-3 -->

        <div class="col-md-3 col-sm-3">
          <div class="item">
            <a href="#">
              <img src="https://s16.postimg.org/4jjqizgld/green_earth.png" width="125" height="126" title="someText" alt="someText">
            </a>
            <h4>25<span>&#37;</span></h4>
            <p>Proin hendrerit velit a lectus vel nibh tincidunt</p>
          </div>
          <!-- item -->
        </div>
        <!-- col-md-3 -->

        <div class="col-md-3 col-sm-3">
          <div class="item">
            <a href="#">
              <img src="https://s16.postimg.org/4yzlpqrwh/leafs.png" width="126" height="126" title="someText" alt="someText">
            </a>
            <h4>75<span>&#37;</span></h4>
            <p>Proin hendrerit velit a lectus vel nibh tincidunt</p>
          </div>
          <!-- item -->
        </div>
        <!-- col-md-3 -->

        <div class="col-md-3 col-sm-3">
          <div class="item">
            <a href="#">
              <img src="https://s16.postimg.org/5d0xpcc01/solar_panels.png" width="130" height="132" title="someText" alt="someText">
            </a>
            <h4>90<span>&#37;</span></h4>
            <p>Proin hendrerit velit a lectus vel nibh tincidunt</p>
          </div>
          <!-- item -->
        </div>
        <!-- col-md-3 -->
      </div>
      <!-- row -->
    </div>
    <!-- facts-content -->
  </div>
  <!-- container -->
</section>
<!-- facts -->

1 个答案:

答案 0 :(得分:1)

如果你担心特定的像素对齐,请不要这样做。在具有如此多屏幕尺寸和分辨率的移动世界中,以精确像素计数并不是很有意义。您的输出看起来很好,并捕捉到PSD的精神。不要试图完全按100%排序。这是徒劳的努力,几乎没有任何好处。