CSS未应用于XUL窗口HTML内容



我正在开发一个非常简单的Firefox扩展,它将记录信息并动态地将它们附加到XUL窗口中的基本HTML表中。

除了HTML表的CSS样式外,一切都正常。它们都没有被应用。我在某处读到添加-moz-appearance: none;到CSS,但它仍然不起作用。有人看到这组XUL和CSS文件有什么问题吗?

XUL文件

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://rmtagfinder/content/log_window/log_window.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://rmtagfinder/locale/translations.dtd">
<window id="rm-tag-finder-log-window"
    title="&rmtagfinder.app.name;"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox flex="1" style="overflow:auto" >
<html:table cellspacing="1" cellpadding="4" bgcolor="#CCCCCC" border="0" id="rm-tag-finder-log-window-html-table">
    <html:thead>
    <html:tr class="tbl_header">
        <html:td width="100">Time</html:td>
        <html:td width="100">Domain</html:td>
        <html:td width="200">Request Made</html:td>
        <html:td width="200">Referer</html:td>
        <html:td width="200">Decoded Info</html:td>
     </html:tr>
    </html:thead>
    <html:tbody></html:tbody>
</html:table>
</vbox>
</window>
CSS文件

@import url("chrome://global/skin/");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.tbl_header {
    -moz-appearance: none;
   font-weight: bolder;
   font-family: Arial, Verdana, Helvetica;
   font-size: 8pt;
   color: #fcfcfc;
   background-color: #4F80AB;
}
tr {
    vertical-align: top;
}
td {
    vertical-align: top;
}

我很快就让它工作了,这是解决方案。我必须在CSS文件中添加以下行,以便它能够识别html名称空间中的CSS样式:

@namespace html url("http://www.w3.org/1999/xhtml");

你只需要使用!important覆盖css样式,因为当你导入

@import url("chrome://global/skin/");已经在window上应用了一些css样式

最新更新