【问题标题】:twitter bootstrap thumbnail alignment issuetwitter bootstrap缩略图对齐问题
【发布时间】:2012-07-20 13:06:00
【问题描述】:

我在 Twitter Bootstrap 中对齐缩略图时遇到问题:

  1. 我正在使用流畅的布局
  2. 我的缩略图是 183 x 154 像素
  3. 我想使用固定的图像尺寸,但边距可变,并且缩略图在它们所在的区域内完全对齐。

这是我目前的结果:

http://i.stack.imgur.com/1qUA6.png

如您所见;图像向左对齐。 缩略图是这样包装的:

 <div class="row-fluid">
     <div class="span6">

我的html:

  <ul id="nwthumbs">
     <li><a href="#" ><img src="Fernando-Alonso-Ferrari-3_2799133.jpg"><h2><span>Fernando Alonso has credited Ferrari's decision to stop for a new set of we...</span></h2></a>
      <button class="btn btn-mini" type="button" >Read More</button></li>
      <li><a href="#" ><img src="Sir-Alex-Ferguson_2794602.jpg">
          <h2><span data-bind="html: titleShortened">Sir Alex Ferguson says there is 'no chance' of Manchester United repeating ...</span></h2></a><button class="btn btn-mini" type="button" >Read More</button></li><li><a href="#" ><img src="Paul-Bohan-2012_2799199.jpg">
 <h2><span>Local Hero claimed a first victory of the year with a determined effort in ...</span>
      </h2> </a><button class="btn btn-mini" type="button" >
                                        Read More</button>
                                </li>
              <li><a href="#" ><img src="Douglas_2675905.jpg">
      <h2><span>FC Twente chairman Joop Munsterman admits he is unsure whether Newcastle Un...</span></h2> </a><button class="btn btn-mini" type="button" >
                                        Read More</button>
                                </li>
                                <li><a href="#" >
                  <img src="Darryl-Westlake-Walsall_2465450.jpg">
                                    <h2>
      <span>Sheffield United have confirmed the signing of promising defender Darryl We...</span>
                                    </h2>
                                </a>
                                    <button class="btn btn-mini" type="button" >
                                        Read More</button>
                                </li>
   </ul>

我正在使用 Twitter Bootstrap。

到目前为止,我尝试过的是使图片大小可变;宽度 100% 和高度 100%,可以,但是当调整到较小的 ViewPort 时,它会调整图像的大小,而不是包装图像,以便它们出现在两列中。

【问题讨论】:

    标签: css twitter-bootstrap thumbnails


    【解决方案1】:

    试试这个 CSS:

    #nwthumbs {
      text-align:center;
    }
    
    #nwthumbs > li {
        display: inline-block;
        *display:inline; /* ie7 fix */
        float: none; /* this is the part that makes it work */
    }
    

    【讨论】:

    • 哇..印象深刻,就是这样!!
    • 我有一两周遇到同样的问题,并在网上找到了这个答案。我不记得在哪里。无论如何,很高兴我帮助了你! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-27
    • 2013-09-24
    • 1970-01-01
    相关资源
    最近更新 更多