两个引导行在响应时未正确对齐

时间:2015-12-10 04:30:28

标签: html css twitter-bootstrap layout

所以我正在开发这个网站,客户想要显示蜂窝模式: http://27.121.66.1/~scsc1126/test.html

它看起来像我想要的常规模式,但在响应模式而不是六边形整齐地坐在彼此之上,第二组向右偏移。我不知道为什么。我确定它很简单,但我无法弄清楚。

以下是代码:



.icon-row-1 {
	position: relative;
	clear: both;
	margin-top: 0px;
	margin-right: auto;
	margin-left: auto;
	margin-bottom: 0;
	width: 90%;
}
.icon-row-2 {
	float: none;
	position: relative;
	clear: both;
	margin-right: auto;
	margin-left: auto;
	margin-bottom: 0;
	width: 60%;
}

<div class="container">
  <h1> COMPETITIONS </h1>
  <p>&nbsp; </p>
  <div class="row text-center">
    <div class="icon-row-1">
      <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/crystal-growing/">
        <h2> Titration </h2>
        <img alt="titration" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/titration.png"/></a></div>
      <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/crystal-growing/">
        <h2> Crystal Growing </h2>
        <img alt="crystal growing" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/crystal-growing.png"/></a></div>
      <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/ancq/">
        <h2> ANCQ </h2>
        <img alt="ancq" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/ancq.png"></a></div>
    </div>
  </div>
  <div class="row text-center">
    <div class="icon-row-2">
      <div class="col-md-6"> <a href="http://schools.raci.org.au/wp/beta/store/"><img alt="store" class="alignnone wp-image-42 size-full" height="347" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/store.png" width="301" />
        <h2> Visit the Store </h2>
        </a></div>
      <div class="col-md-6"> <a href="http://schools.raci.org.au/wp/beta/other-initiatives/"><img alt="other-initiatives" class="alignnone wp-image-1123 size-full" height="347" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/other-initiatives.png" width="301" />
        <h2> Other Initiatives </h2>
        </a></div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

我做错了什么???这让我疯了。

3 个答案:

答案 0 :(得分:0)

   

 img{max-width: 100%; height: auto;}
    .icon-row-1 {
    	position: relative;
    	clear: both;
    	margin-top: 0px;
    	margin-right: auto;
    	margin-left: auto;
    	margin-bottom: 0;
    	width: 90%;
    }
    .icon-row-2 {
    	float: none;
    	position: relative;
    	clear: both;
    	margin-right: auto;
    	margin-left: auto;
    	margin-bottom: 0;
    	width: 60%;
    }
    <div class="container">
      <h1> COMPETITIONS </h1>
      <p>&nbsp; </p>
      <div class="row text-center">
        <div class="icon-row-1">
          <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/crystal-growing/">
            <h2> Titration </h2>
            <img alt="titration" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/titration.png"/></a></div>
          <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/crystal-growing/">
            <h2> Crystal Growing </h2>
            <img alt="crystal growing" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/crystal-growing.png"/></a></div>
          <div class="col-md-4"><a href="http://schools.raci.org.au/wp/beta/competition/ancq/">
            <h2> ANCQ </h2>
            <img alt="ancq" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/ancq.png"></a></div>
        </div>
      </div>
      <div class="row text-center">
        <div class="icon-row-2">
          <div class="col-md-6"> <a href="http://schools.raci.org.au/wp/beta/store/"><img alt="store" class="alignnone wp-image-42 size-full" height="347" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/store.png" width="301" />
            <h2> Visit the Store </h2>
            </a></div>
          <div class="col-md-6"> <a href="http://schools.raci.org.au/wp/beta/other-initiatives/"><img alt="other-initiatives" class="alignnone wp-image-1123 size-full" height="347" src="http://schools.raci.org.au/wp/beta/wp-content/uploads/2014/03/other-initiatives.png" width="301" />
            <h2> Other Initiatives </h2>
            </a></div>
        </div>
      </div>
    </div>

答案 1 :(得分:0)

添加此CSS

img {
height: auto;
max-width: 100%;
}

答案 2 :(得分:0)

看看jsfiddle
添加此css:

img {
 height: auto;
 max-width: 100%;

}