我使用了 Bootstrap Grid 格式,这样我就可以对齐我的图像,但由于某种原因它不起作用。它们都在左边,就像我将它们设置为 block 一样,如果我将它们的位置设置为内联 block ,它也不会起作用。我如何才能对其进行编辑,以便我的 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>
最佳答案
像这样的事情应该让你开始......
每个水平行应该在 <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>
<div class="row1" width="100%">
<div class="col-xs-2"></div>
<div class="col-xs-4 members" id="ohno">
<img src="http://placeimg.com/100/100/animals" class="img-responsive">
<span class="text">Satoshi Ohno(Leader)<br>Birth: 26-11-1980, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1994</span>
</div>
<div class="col-xs-4 members" id="sakurai">
<img src="http://placeimg.com/100/100/animals" class="img-responsive">
<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 class="col-xs-2"></div>
</div><!-- .row -->
<div class="row1" width="100%">
<div class="col-xs-4"></div>
<div class="col-xs-4 members" id="aiba">
<img src="http://placeimg.com/100/100/animals" class="img-responsive">
<span class="text">Masaki Aiba<br>Birth: 24-12-1982, <br>Chiba (Jpn)<br>Joined "Johnnys" in 1996</span>
</div>
<div class="col-xs-4"></div>
</div><!-- .row -->
<div class="row" width="100%">
<div class="col-xs-6 members text-center" id="ninomiya">
<div>
<img src="http://placeimg.com/100/100/animals" class="img-responsive imgIB">
</div>
<span class="text">Kazunari Ninomiya<br>Birth: 17-06-1983,<br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span>
</div>
<div class="col-xs-6 members text-center" id="matsumoto">
<div>
<img src="http://placeimg.com/100/100/animals" class="img-responsive imgIB">
</div>
<span class="text">Jun Matsumoto<br>Birth:30-08-1983, <br>Tokyo (Jpn)<br>Joined "Johnnys" in 1996</span>
</div>
</div><!-- .row -->
</div>
关于html - 使用 Bootstrap Grid 对齐内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41154638/