2013-02-25 73 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