2010-05-24 58 views
4

當發佈爲HTML時,DITA Open Toolkit會自動創建一些內聯表格屬性,包括frame =「border」和rules =「all」。如何使用CSS覆蓋HTML「規則」屬性?

我需要使用單元格的CSS樣式來覆蓋這個「規則」屬性,雖然我可以在IE和Chrome中獲得所需的結果,但是Firefox會在表格中放置純黑色網格線,並拒絕就此事發表意見。

很顯然,我不能編輯HTML,公司政策是不編輯XSLT,那麼如何才能使用CSS單獨刪除這些網格線呢?

我已經嘗試過各種狡猾的border-xxxxxx樣式組合,並給出它們!重要聲明不起作用。

的HTML說...

<table cellpadding="4" cellspacing="0" frame="border" border="1" rules="all"> 
<thead> 
    <tr> 
     <th class="cellrowborder">Type </th> 
     <th class="cellrowborder">Comment </th> 
    </tr> 
</thead> 
    <tbody> 
    <tr> 
     <td class="cellrowborder">Caution </td> 
     <td class="cellrowborder">Think twice. </td> 
    </tr> 
    <tr> 
     <td class="cellrowborder">Attention </td> 
     <td class="cellrowborder">Be careful. </td> 
    </tr> 
    <tr> 
     <td class="cellrowborder">Danger </td> 
     <td class="cellrowborder" >Be scared. Be very scared. </td> 
    </tr> 
    </tbody> 
</table> 

的CSS說

table {border: 1px solid black; 
font-family: Arial, Helvetica, sans-serif; 
border-collapse: collapse; 
font-size: 9pt; 
margin-top: 1em; 
margin-bottom: 1em; 
padding: 4px;} 

tr {border: none;} 

.cellrowborder {border: none;} 

因此,儘管它看起來我在IE預期,但它不能在Firefox,除非我刪除這些幀/ border/rules屬性。我無法生產。

回答

0

也許使用FireBug Inspect Element可以幫助你檢測CSS屬性,並允許你在Firefox中定位它(instructions here)。

你能發表一個代碼的例子嗎?

2

在文檔加載中使用jQuery的remove屬性將舊屬性全部刪除。

api.jquery.com/removeAttr

1

border-color似乎適用。

+0

只有在Webkit中,不是Firefox – ajcw 2012-02-13 15:16:51

+0

在Firefox中適用。 – reisio 2012-02-13 21:55:30

+0

請給出一個在Firefox中工作的例子。這不在FF10中 - http://jsfiddle.net/ajcw/GYYHb/ – ajcw 2012-02-14 08:35:57

2

我已經和<table frame="border" rules="all">快速玩過了。關鍵似乎是另一個邊界來覆蓋它,例如:

table { 
    border: none; 
    border-collapse: collapse; 
} 
    td { 
     border: 1px solid silver; 
    } 

這不是理想的,如果你需要完全消除邊界,但我想你可以匹配border-color頁面背景是什麼?