2013-02-25 78 views
0

我对twitter引导世界和基于%的宽度比较陌生,并且很容易让自己大惑不解,应该是一件容易的事情。居中左浮动内容twitter引导

我正在尝试将我的页面上每个左浮动的.subimg居中。很明显margin:0 auto不会工作,因为它不是一个静态网格。我用父div的文本对齐中心无济于事。我的标记是如下:

<style> 
.subimg{float:left;} 
.row-fluid{text-align:center;} 
</style> 

<div class="row-fluid"><!-- begin row --> 
    <div class="span12 subimgstrip"> 
      <div class="subimg"> 
       <a href="#"> 
        <img src="/wp-content/themes/wordpress-bootstrap/img/products/infection/1.jpg"/> 
        <h6>Customize Settings</h6> 
       </a> 
      </div> 
      <div class="subimg"> 
       <a href="#"> 
         <img src="/wp-content/themes/wordpress-bootstrap/img/products/infection/2.jpg"/> 
         <h6>Set Specific Criteria</h6> 
       </a> 
      </div> 
      <div class="subimg"> 
       <a href="#"> 
         <img src="/wp-content/themes/wordpress-bootstrap/img/products/infection/3.jpg"/> 
         <h6>Customize Alerts</h6> 
       </a> 
      </div> 
      <div class="subimg"> 
       <a href="#"> 
         <img src="/wp-content/themes/wordpress-bootstrap/img/products/infection/4.jpg"/> 
         <h6>Create Antibiograms</h6> 
       </a> 
      </div> 
      <div class="subimg"> 
       <a href="#"> 
         <img src="/wp-content/themes/wordpress-bootstrap/img/products/infection/5.jpg"/> 
         <h6>Isolate Information</h6> 
       </a> 
      </div> 
     </div> 
    </div><!-- end row --> 
+1

一个风格,你不能居中的东西,是浮动的,除非你知道宽度或父母,那么你可以应用正确的边距,使你的浮动div看起来居中 – Pete 2013-02-25 16:28:20

+0

正确的,只是意识到,我正在采取浮动(duhh时间)'显示设置区域的内容:内联块'似乎为我解决它。任何我不应该使用它的理由? – gschervish 2013-02-25 16:29:38

+0

我可以想到的没有理由 – Pete 2013-02-25 16:30:47

回答

0

最好的办法中心与浮动引导Twitter的内容是给浮动元素的display:inline-block;风格,给家长的div text-align:center