2014-02-11 31 views
0

尋找一些幫助,在這裏請FloatLeft不工作。我正在創建從我們的數據庫中提取信息的表格。我有兩列在顯示時將數據左移到左側,並且它工作正常....除非數據超過一行並將其包裹,然後將其浮在中心出於某種原因。當文字開始換行

下面是代碼。

<table width="100%" cellspacing="0" cellpadding="0" border="0" class="mainTable"> 
    <tbody> 
    <tr> 
     <th class="w12p"><span class="marginLft05 css3 floatLeft">Type</span></th> 
     <th class="w20p"><span class="marginLft05 css3 floatLeft">Detail</span></th> 
    </tr> 
<? 
foreach($product_specifications as $key => $specification): 
?> 
     <tr class="<?=iif($key % 2 == 0, 'lightSpecRow', 'darkSpecRow')?>"> 
    <td> 
     <span class="marginLft05 font14 css3 floatLeft"><?=$specification['name']?></span> 
    </td> 
    <td> 
     <span class="marginLft05 font14 css3 floatLeft"><?=$specification['value']?></span> 
    </td> 
</tr> 
<? 
endforeach; 
?> 
    </tbody> 
</table> 

問題與

<td> 
<span class="marginLft05 font14 css3 floatLeft"><?=$specification['value']?></span> 
</td> 

任何和所有幫助表示感謝,謝謝!

謝謝大家,所有的意見和建議後,我開始思考在不同的方向,我發現一種方式來獲得它在表類的變化工作。

加入留在表類定義的浮動似乎對所有的瀏覽器

+0

凡類的'CSS'定義'floatleft'?那個班可以有任何東西,如果沒有它,診斷你的問題是不可能的。 –

+0

爲什麼不使用'內容'? –

+1

我舉了一個例子來嘗試診斷你的問題,隨時使用它並添加到它。 http://jsbin.com/zarar/1/ – snollygolly

回答

0

您已經定義TD對準.mainTable tr td類中心工作。

您應該刪除這個屬性和刪除floatLeft類(不需要這個類,一旦你刪除文本居中對齊)。

移除此屬性,將被視爲text-align: left默認。

更新jsbin:http://jsbin.com/zarar/13/