我有一个带有表单的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&v=3.0" /><script type="text/javascript" src="/Jenny/faces/javax.faces.resource/jquery/jquery.js?ln=primefaces&v=3.0"></script><script type="text/javascript" src="/Jenny/faces/javax.faces.resource/primefaces.js?ln=primefaces&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>
答案 0 :(得分:0)
我可以建议您检查div
元素中的内部form
是否在正常流程中。
看看两个小提琴:第一个从前一个答案中被盗并稍微修改一下,我希望Aquillo不介意=)。
http://jsfiddle.net/skip405/m6k3b/3/ - 在这里我们可能会看到背景颜色未应用于表单(我假设的情况相同)。请注意div
是浮动的 - 这意味着它已从正常流中移除。
http://jsfiddle.net/skip405/m6k3b/2/ - 在这里我为父元素添加了一个简单的修复(你可以选择其他的,如果你知道的话),以便说出看看它的子节点并防止它崩溃
您可以在此处阅读normal flow。
希望能帮到你。