【问题标题】:CSS not being applied to XUL window HTML contentsCSS 未应用于 XUL 窗口 HTML 内容
【发布时间】:2011-11-30 17:02:27
【问题描述】:

我正在开发一个非常简单的 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;
}

【问题讨论】:

    标签: html css firefox-addon xul background-color


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-10-03
        • 2014-01-22
        • 1970-01-01
        • 1970-01-01
        • 2014-03-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多