2010-01-05 66 views
-1

我創建了一個HTML表,並使用了以下CSS樣式的邊界,因爲我想:普通HTML表格邊框出現很奇怪的Firefox

  1. 頂行和列,是一個顏色,表格的其餘部分是條紋替代的行顏色。在每個單元

這裏

  • 普通單一的黑色邊框是我的CSS:

    #functionMatrixTable td 
    { 
        border-collapse: collapse; 
        border-width: 1px; 
        border-color: Black; 
        border-style: solid; 
    } 
    
    #functionMatrixTable th 
    { 
        border-collapse: collapse; 
        border-width: 1px; 
        border-color: Black; 
        border-style: solid; 
    } 
    
    #functionMatrixTable tbody tr.odd th, tbody tr.even th { 
        background-color: #D8D8D8; 
    } 
    
    
    #functionMatrixTable tr.odd td{ 
        background-color: #ffffff; 
        padding: 4px; 
    } 
    
    #functionMatrixTable tr.even td { 
    background-color: #CDE0F6; 
        padding: 4px; 
    } 
    
    #functionMatrixTable th 
    { 
        padding: 4px; 
        background-color: #D8D8D8; 
        color: #787878; 
    } 
    

    Firefox中的奇怪的問題是,它似乎把一個邊框我的表的一半,但不是其餘。這是一個示例圖像。它在IE8中看起來很好。任何想法我在這裏做錯了嗎?

    Firefox中我的HTML表格的屏幕截圖。當我點擊一個單元格時,出現邊框。爲什麼?

    alt text http://img40.imageshack.us/img40/5126/htmltable.png

  • +0

    HTML樣本請嗎? – 2010-01-05 05:31:03

    回答

    1

    我想你在生成你的HTML,基於該截圖中的代碼有錯誤的地方,我會說,你的表HTML格式不正確。另外,您提供的示例CSS似乎不完整。

    我只是想下面的示例(有一些CSS修改),並且它在Firefox正常顯示的表周圍的所有元素邊界(對不起,我不能在IE中測試這個):

    <html> 
    <head> 
    <style type="text/css"> 
    
    #functionMatrixTable 
    { 
        border-collapse:collapse; 
        border-width:1px; 
        border-color: Black; 
        border-style: solid; 
    } 
    
    #functionMatrixTable td, th 
    { 
        border-collapse:collapse; 
        border-width:1px; 
        border-color: Black; 
        border-style: solid; 
    } 
    
    #functionMatrixTable tr.odd td{ 
        background-color: #ffffff; 
        padding:4px; 
    } 
    
    #functionMatrixTable tr.even td { 
        background-color: #CDE0F6; 
        padding:4px; 
    } 
    
    #functionMatrixTable th 
    { 
        padding:4px; 
        background-color:#D8D8D8 ; 
        color:#787878 ; 
    } 
    </style> 
    </head> 
    <body> 
    <table id="functionMatrixTable"> 
    <tr> 
    <th>AAA</th> 
    <th>BBB</th> 
    </tr> 
    <tr class="odd"> 
    <td>A</td> 
    <td>B</td> 
    </tr> 
    <tr class="even"> 
    <td>C</td> 
    <td>D</td> 
    </tr> 
    <tr class="odd"> 
    <td>A</td> 
    <td>B</td> 
    </tr> 
    <tr class="even"> 
    <td>C</td> 
    <td>D</td> 
    </tr> 
    <tr class="odd"> 
    <td>A</td> 
    <td>B</td> 
    </tr> 
    <tr class="even"> 
    <td>C</td> 
    <td>D</td> 
    </tr> 
    </table> 
    </body> 
    </html> 
    

    如果你的表格是靜態HTML,那麼類似上面的東西應該在Firefox中呈現,沒有問題。如果您即時渲染表格,那麼您使用的方法很可能與Firefox不兼容。你可能使用JavaScript嗎?

    +0

    是。 。我有而不是 – leora 2010-01-05 06:16:45

    +0

    它發生。 :) 很高興你找到它。 – 2010-01-05 06:24:24

    +0

    它的驚人的一個壞字符可以做一個應用程序:) – leora 2010-01-05 12:54:43