2016-12-15 80 views
0

我用引導網格格式,這樣我就能夠對準我的圖像,但由於某種原因,它不工作。他們都像在左邊一樣,就好像我已經把它們設置爲塊一樣,如果我把它們的位置作爲內聯塊也是行不通的。我將如何編輯它,以便我的5張圖像具有響應格網格式?引導網格對齊內容

<div id="section2" class="container-fluid"> 
    <h2>The Members</h2> 
    <h3 id="hoverovertext">(Hover-over each member to learn more)</h3> 
     <div class="row1" width="100%"> 
      <div class="members col-md-4" id="ohno" height="225px"> 
       <img src="images/ohno.jpg" class="images" height="225px"> 
       <span class="text">Satoshi Ohno(Leader)<br>Birth: 26-11-1980, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1994</span> 
      </div>  

      <div class="members col-md-4" id="sakurai" height="225px"> 
       <img src="images/sakurai.jpg" class="images" height="225px"> 
       <span class="text">Sho Sakurai<br>Birth: 25-01-1982, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1995<br>Graduated Keio University</span> 
      </div> 
     </div> 
      <div class="members col-md-4" id="aiba" height="225px"> 
       <img src="images/aiba.jpg" class="images" height="225px"> 
       <span class="text">Masaki Aiba<br>Birth: 24-12-1982, <br>Chiba (Jpn)<br>Joined "Johnnys" in 1996</span> 
      </div>  
     <div class="row2" width="100%"> 
      <div class="members col-md-6" id="ninomiya" height="225px"> 
       <img src="images/ninomiya.jpg" class="images" height="225px"> 
       <span class="text">Kazunari Ninomiya<br>Birth: 17-06-1983,<br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span> 
      </div>  

      <div class="members col-md-6" id="matsumoto" height="225px"> 
       <img src="images/matsumoto.jpg" class="images" height="225px"> 
       <span class="text">Jun Matsumoto<br>Birth:30-08-1983, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span> 
      </div>  
     </div> 

+0

我覺得一個山坳'-MD-4'需要是'row1'內。也確保了'圖像的width'是'100%' –

+0

我想它,以便有在底部頂行3倍的圖像和2但由於屏幕變小,它變得像棋盤 –

回答

0

像這樣的東西應該讓你開始...

每水平行應在<div class="row">

裏面一排,所有col加起來應該12.所以, ,還有2 + 4 + 4 + 2行,還有6 + 6行等。

不要忘記class="img-responsive"對圖像很有用。

.imgIB{display:inline-block !important;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 

 
<div id="section2" class="container-fluid"> 
 
    <h2>The Members</h2> 
 
    <h3 id="hoverovertext">(Hover-over each member to learn more)</h3> 
 

 
\t <div class="row1" width="100%"> 
 
\t \t <div class="col-xs-2"></div> 
 
\t \t <div class="col-xs-4 members" id="ohno"> 
 
\t \t \t <img src="http://placeimg.com/100/100/animals" class="img-responsive"> 
 
\t \t \t <span class="text">Satoshi Ohno(Leader)<br>Birth: 26-11-1980, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1994</span> 
 
\t \t </div> 
 
\t \t <div class="col-xs-4 members" id="sakurai"> 
 
\t \t \t <img src="http://placeimg.com/100/100/animals" class="img-responsive"> 
 
\t \t \t <span class="text">Sho Sakurai<br>Birth: 25-01-1982, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1995<br>Graduated Keio University</span> 
 
\t \t </div> 
 
\t \t <div class="col-xs-2"></div> 
 
\t </div><!-- .row --> 
 

 
\t <div class="row1" width="100%"> 
 
\t \t <div class="col-xs-4"></div> 
 
\t \t <div class="col-xs-4 members" id="aiba"> 
 
\t \t \t <img src="http://placeimg.com/100/100/animals" class="img-responsive"> 
 
\t \t \t <span class="text">Masaki Aiba<br>Birth: 24-12-1982, <br>Chiba (Jpn)<br>Joined "Johnnys" in 1996</span> 
 
\t \t </div>  
 
\t \t <div class="col-xs-4"></div> 
 
\t </div><!-- .row --> 
 

 
\t <div class="row" width="100%"> 
 
\t \t <div class="col-xs-6 members text-center" id="ninomiya"> 
 
\t \t \t <div> 
 
       <img src="http://placeimg.com/100/100/animals" class="img-responsive imgIB"> 
 
      </div> 
 
\t \t \t <span class="text">Kazunari Ninomiya<br>Birth: 17-06-1983,<br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span> 
 
\t \t </div> 
 
\t \t <div class="col-xs-6 members text-center" id="matsumoto"> 
 
\t \t \t <div> 
 
       <img src="http://placeimg.com/100/100/animals" class="img-responsive imgIB"> 
 
      </div> 
 
\t \t \t <span class="text">Jun Matsumoto<br>Birth:30-08-1983, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span> 
 
\t \t </div>  
 
\t </div><!-- .row --> 
 
</div>

+0

我試圖包括這些變化,但它似乎沒有工作,當我包括文本中心,只是將文本單獨移動到頁面的中心。這是我的CSS頁面。 –

+0

/* CSS的網頁的成員部分* /# 第2節{ 填充頂:50像素; height:775px; color:#0000CD; background-color:#ADD8E6; 寬度:100%; } #hoverovertext { 字體大小:16px的; } .members { position:relative; padding:0px 0px 200px 0px; 寬度:100%; } .images { position:absolute; padding:20px; z-index:1; } .images:hover { opacity:0.35; } .text { position:absolute; padding:25px; 寬度:100%; } .imgIB {display:inline-block; } –

+0

你是過度造型。使用Bootstrap的原因是爲了利用其風格。當您將'position:absolute'應用於圖像時,您可以撤銷引導程序的默認設置。引導程序的設計使您儘可能少地使用手動CSS樣式。對於樣式,添加額外的Bootstrap類(如「文本中心」等)。在Bootstrap上觀看更多YouTube視頻。這裏有一個很好的來源:codedamn YouTube頻道(https://www.youtube.com/channel/UCJUmE61LxhbhudzUugHL2wQ) – gibberish