2013-03-18 160 views
0

我在其他一些HTML元素中有一個表格,它呈現出奇怪的 - 即使我將它設置爲css爲摺疊狀態,出現邊框空間。 表看起來是這樣的:html表格邊框問題

enter image description here

和HTML是這樣的:

<table cellspacing="0" border="1" class="scrollable-headers-only" title="" cellpading="0"> 
     <thead title=""> 
      <tr title=""> 
       <th class="check" title=""></th> 
       <th class="type" title=""></th> 
       <th class="name" title="">Name</th> 
       <th class="address center-column" title="">Address</th> 
       <th class="domain" title="">Domain</th> 
       <th class="status" title="">Status</th> 
      </tr> 
     </thead> 
    </table> 

和CSS,因爲它出現在Firebug是這樣的:

  • 爲主表: enter image description here

  • 每個日:

enter image description here

我加邊境只有太見S [細胞之間的尖子。我的問題是要消除這個空間。我在表格中添加了cellpading和cellspacing = 0,但沒有區別。我添加了css來消除這個空間,而不需要改變渲染。

此表用作另一個表的標題,我需要將它的列與另一個表對齊 - 從圖像中可以看到,表格下有小行。我需要將此表與第二個表對齊,因爲這個原因對於獲得100%的精度非常重要。

怎麼了? 謝謝。

+4

請在這裏發佈實際的CSS,而不僅僅是它的圖片。 – j08691 2013-03-18 15:23:00

+2

[JSFiddle replication](http://jsfiddle.net)或類似的會更好! – 2013-03-18 15:24:40

+0

@ j08691:css被分割成幾個文件(我使用less.js來構建它)。 – 2013-03-18 15:28:21

回答

0

我會從刪除display: inline-block;thtable元素開始。 Firefox將這些視爲內聯元素並插入額外的空間。消除它的另一種方法是對table設置font-size: 0;,對於th元件設置示例font-size: 12px;

+0

我已經做到了。這並沒有幫助。顯示器:內嵌塊需要在那裏。 – 2013-03-18 15:43:05

+0

@Zelter Ady 1)爲什麼它必須是內聯塊?它沒有任何敏感。 2)然後使用第二種解決方案 - 字體大小:0. – 2013-03-19 15:16:13

+0

@Zelter Ady這裏的工作示例:[工作示例](http://codepen.io/anon/pen/AfzgB) - 如果您刪除了'font-大小:0「的表格,你會發現'inline-block'造成了麻煩。 – 2013-03-19 15:21:59