0

我有一个 JSF 页面,上面有一个表单。我可以修改此表单的几乎所有属性,但不能修改背景颜色。到目前为止,我已经像这样从 css 尝试过:

.login_panel {
    background-image: none;
    background: gainsboro !important;
    background-color: gainsboro !important;
    width: 50%;
    font-family: monospace;
    font-size: 12px;
}

并将此样式类应用于表单,例如

<h:form styleClass="login_panel">...

好吧,每个设置都很好,但背景仍然是白色的。有什么办法可以改变表单的 bgcolor 吗?到目前为止,我找不到任何答案。

@Edit:生成的 HTML 源代码:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/Jenny/faces/javax.faces.resource/theme.css?ln=primefaces-aristo" /><link type="text/css" rel="stylesheet" href="/Jenny/faces/javax.faces.resource/primefaces.css?ln=primefaces&amp;v=3.0" /><script type="text/javascript" src="/Jenny/faces/javax.faces.resource/jquery/jquery.js?ln=primefaces&amp;v=3.0"></script><script type="text/javascript" src="/Jenny/faces/javax.faces.resource/primefaces.js?ln=primefaces&amp;v=3.0"></script>
        <title>WebMethods Testing Suite</title>
        <link rel="stylesheet" type="text/css" href="design/style.css" /></head><body style="margin-left: auto; margin-right: auto">
        <center>
            <h1>Jenny</h1>

            <!-- Login to the integration server -->
<form id="j_idt8" name="j_idt8" method="post" action="/Jenny/faces/index.xhtml" class="login_form" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt8" value="j_idt8" />
<div id="j_idt8:server_data" class="ui-panel ui-widget ui-widget-content ui-corner-all login_panel"><div id="j_idt8:server_data_content" class="ui-panel-content ui-widget-content"><table>
<thead>
<tr><th colspan="2" scope="colgroup">
                            Servers
                        </th></tr>
</thead>
<tfoot>
<tr><td colspan="2"><button id="j_idt8:j_idt16" name="j_idt8:j_idt16" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({formId:'j_idt8',source:'j_idt8:j_idt16',process:'@all',update:'j_idt8:status'});return false;" type="submit"><span class="ui-button-text">Connect</span></button><script id="j_idt8:j_idt16_s" type="text/javascript">PrimeFaces.cw('CommandButton','widget_j_idt8_j_idt16',{id:'j_idt8:j_idt16'});</script>
                            <br /><label id="j_idt8:status">
Not initialized...</label></td></tr>
</tfoot>
<tbody>
<tr>
<td><label for="j_idt8:url" class="output_label">
Server address</label></td>
<td><table id="j_idt8:url">
    <tr>
<td>
<input type="radio" name="j_idt8:url" id="j_idt8:url:0" value="10.125.112.20:10601" /><label for="j_idt8:url:0"> 10.125.112.20:10601</label></td>
    </tr>
</table></td>
</tr>
<tr>
<td><label for="j_idt8:userName" class="output_label">
User name:</label></td>
<td><input id="j_idt8:userName" name="j_idt8:userName" type="text" value="" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /><script id="j_idt8:userName_s" type="text/javascript">PrimeFaces.cw('InputText','widget_j_idt8_userName',{id:'j_idt8:userName'});</script></td>
</tr>
<tr>
<td><label for="j_idt8:password" class="output_label">
Password</label></td>
<td><input id="j_idt8:password" type="password" name="j_idt8:password" value="" /></td>
</tr>
<tr>
<td><label for="j_idt8:packageName" class="output_label">
Default package</label></td>
<td><input id="j_idt8:packageName" type="text" name="j_idt8:packageName" /></td>
</tr>
</tbody>
</table>
</div></div><script id="j_idt8:server_data_s" type="text/javascript">PrimeFaces.cw('Panel','widget_j_idt8_server_data',{id:'j_idt8:server_data'});</script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-494924954700381044:6977213687741547564" autocomplete="off" />
</form>

        </center></body>
</html>
4

1 回答 1

0

我可以建议您检查元素中的内部是否处于正常流程中divform

看看两个小提琴:第一个是从上一个答案中偷来的,并做了一些修改,我希望 Aquillo 不介意 =)。

http://jsfiddle.net/skip405/m6k3b/3/ - 在这里我们可能会看到背景颜色没有应用于表单(我假设你的情况相同)。请注意,它div是浮动的 - 这意味着它已从正常流程中移除。

http://jsfiddle.net/skip405/m6k3b/2/ - 在这里我为父元素添加了一个简单的修复(如果你知道它们,你可以选择其他),可以这么说查看它的子元素并防止它崩溃。

您可以在此处阅读有关正常流程的信息。

希望对您有所帮助。

于 2013-05-30T07:56:24.653 回答