2013-05-08 33 views
0

HTML結構是這樣的:爲什麼CSS背景色使TD寬度增量

<table class="barby-barcode"> 
    <tbody> 
    <tr class="barby-row"> 
     <td class="barby-cell on"></td> 
     <td class="barby-cell on"></td> 
     <td class="barby-cell on"></td> 
    </tr> 
    </tbody> 
</table> 

CSS是這樣的:

table.barby-barcode { border-spacing: 0; } 
tr.barby-row { height: 100px; } 
td.barby-cell { width: 3px; height: 3px; } 
td.barby-cell.on { background: #000; } 

但實際上顯示的是td.barby-cell.on寬度爲5px ,爲什麼寬度增量

回答

0

第一:「表」,「TR」等是沒有必要的。 「.barby- [sth]」就是識別班級所需的一切。

第二:你是否檢查過邊距,填充和邊框都是0?