bootstrap缩略图没有正确堆叠

时间:2013-04-07 23:38:32

标签: html css twitter-bootstrap

我在bootstrap中的缩略图与它们有不同的高度,我认为这个问题可能导致它们无法正确堆叠(请参见截图和小提琴)。我想我需要为他们包括一个最小高度,但我只是无法让它工作..任何人都能伸出援助之手吗?

以下是我的代码:

<body>
    <div class="container-fluid">
      <div class="hidden-phone">
        <a href="newBook.php">
        <button class="btn btn-large btn-primary" style="float:right; margin-top:30px;" type="button">Add Book</button>
        </a>
      </div>
      <div class="row-fluid">
        <div class="span12 well">

        <div class="row-fluid">
          <ul class="thumbnails">

            <li class="span4">
              <div class="thumbnail">
                <img src="http://placehold.it/320x200" alt="ALT NAME">
                <div class="caption">
                  <h3>Title</h3>

                  <p>Seller: Me</p>
                  <p>Email: </p>
                  <p>Cost: </p>
                  <p>Condition: </p>
                  <p align="center">
                    <a href="#myModal" class="btn btn-primary btn-block" data-toggle="modal">View More information</a>
                  </p>
                </div>
              </div>
            </li> 
             <li class="span4">
              <div class="thumbnail">
                <img src="http://placehold.it/320x200" alt="ALT NAME">
                <div class="caption">
                  <h3>Title</h3>
                  <span class="label label-warning" style="margin-bottom: 10px;">Book has been sold!</span>
                  <p>Seller: Me</p>
                  <p>Email: </p>
                  <p>Cost: </p>
                  <p>Condition: </p>
                  <p align="center">
                    <a href="#myModal" class="btn btn-primary btn-block" data-toggle="modal">View More information</a>
                  </p>
                </div>
              </div>
            </li> 
             <li class="span4">
              <div class="thumbnail">
                <img src="http://placehold.it/320x200" alt="ALT NAME">
                <div class="caption">
                  <h3>Title</h3>

                  <p>Seller: Me</p>
                  <p>Email: </p>
                  <p>Cost: </p>
                  <p>Condition: </p>
                  <p align="center">
                    <a href="#myModal" class="btn btn-primary btn-block" data-toggle="modal">View More information</a>
                  </p>
                </div>
              </div>
            </li> 

             <li class="span4">
              <div class="thumbnail">
                <img src="http://placehold.it/320x200" alt="ALT NAME">
                <div class="caption">
                  <h3>Title</h3>

                  <p>Seller: Me</p>
                  <p>Email: </p>
                  <p>Cost: </p>
                  <p>Condition: </p>
                  <p align="center">
                    <a href="#myModal" class="btn btn-primary btn-block" data-toggle="modal">View More information</a>
                  </p>
                </div>
              </div>
            </li> 
                         <li class="span4">
              <div class="thumbnail">
                <img src="http://placehold.it/320x200" alt="ALT NAME">
                <div class="caption">
                  <h3>Title</h3>

                  <p>Seller: Me</p>
                  <p>Email: </p>
                  <p>Cost: </p>
                  <p>Condition: </p>
                  <p align="center">
                    <a href="#myModal" class="btn btn-primary btn-block" data-toggle="modal">View More information</a>
                  </p>
                </div>
              </div>
            </li> 

          </ul>
        </div>
    </div>
    </div>
    </div>

  </body>

小提琴:http://jsfiddle.net/Z3VwZ/

屏幕: enter image description here enter image description here

1 个答案:

答案 0 :(得分:4)

不,div的高度不是问题。问题是你必须在.span4类的一个div中只放置三个.row-fluid类的div。如果你想要更多带有.span4的div,你必须创建一个带有.row-fluid类的新div并将那些新的.span4 div放入其中。 See Twitter bootstrap official documentation

例如,这是有效的Twitter Bootstrap标记

<div class="row-fluid">
   <div class="span4"></div>
   <div class="span4"></div>
   <div class="span4"></div>
</div>

<div class="row-fluid">
   <div class="span4"></div>
   <div class="span4"></div>
   <div class="span4"></div>
</div>

<div class="row-fluid">
   <div class="span12"></div>
</div>

<div class="row-fluid">
   <div class="span8"></div>
   <div class="span1"></div>
   <div class="span3"></div>
</div>

以下是使用您的代码&gt;&gt;&gt;的工作演示http://jsfiddle.net/Z3VwZ/1/