【发布时间】:2012-11-28 11:56:54
【问题描述】:
我正在尝试将 XUL 用于 Intranet 应用程序。
我遇到了一个 CSS 问题,样式中的 where 和 !important 指令对类为“error”的文本框元素没有任何影响。
textbox.error {
background-color: #F00 !important;
}
仅当我添加 -moz-appearance: none;它开始工作,但它丢失了该元素的所有样式。
有没有办法只重载 background-color 属性(在这种情况下)?
我希望我的应用程序具有原生外观,因此这不是最理想的。
谢谢
-- 编辑--
这是 XUL 结构:
<?xml version="1.0"?>
<?xml-stylesheet href="/_backend/views/css/xul.css" type="text/css"?>
<window
id="workorders-edit-window"
title="{$title}"
orient="horizontal"
width="500"
height="400"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<vbox flex="1" orient="vertical">
<groupbox>
<caption label="Osnovne informacije"/>
<hbox flex="5">
<vbox>
<label control="ref" value="Št. delovnega naloga"/>
<textbox id="ref" size="10" value="" class="error"/>
</vbox>
</hbox>
</groupbox>
</vbox>
</window>
还有 CSS:
@import url(chrome://global/skin/);
textbox.error {
background-color: #F00;
}
【问题讨论】:
-
HTML 是什么样的?
-
您是否尝试过更具体的选择器?如果没有看到 html,将很难提供替代方案,除非在极端情况下,否则不应真正使用 !important
-
添加了 xul 和 css。我尝试了 textbox#ref 甚至 inline (in style="") 但都没有任何效果。仅当我添加 -moz-appearance: none 时。