简体   繁体   English

<h:inputText>启用/禁用 - 更改背景颜色

[英]<h:inputText> enabled/disabled - change background color

can I change background color for disabled <h:inputText> ? 我可以更改禁用<h:inputText>背景颜色吗?

I've tried to do this way: 我试过这样做:

<h:inputText value="test" disabled="true" styleClass="input"/>

css contains: css包含:

input:disabled {background-color:blue;}
input:enabled {background-color:red;}

and result is: 结果是:

在此输入图像描述

reason, why I'm trying to change the background is, that since I've installed richfaces, disabled and enabled has the same color, both are white 原因,为什么我要改变背景是,因为我已经安装了richfaces,禁用和启用了相同的颜色,都是白色的

Thank you 谢谢

UPDATE: 更新:

在此输入图像描述

HTML: HTML:

<td class="width10">Směna:</td>
<td class="width15"><input name="bde:j_idt100" value="2011-05-18-S2" size="13" style="background-color: blue; color: red;" disabled="disabled" type="text"><input id="bde:shift" name="bde:shift" type="hidden"></td>
<td><input name="bde:j_idt102" value="ranní" class="input2" size="13" disabled="disabled" type="text"><input name="bde:j_idt103" value="admin" class="input2" size="13" disabled="disabled" type="text"></td>
</tr>
<tr class="rowEven">
<td class="width5"><input id="bde:f1" name="bde:f1" value="F1" tabindex="2" title="Novy pracovnik - vymaze vsechna pole formulare" class="btninput" type="submit"></td>
<td class="width10">Pracovník:</td>
<td class="width15">
<input id="bde:worker" name="bde:worker" class="input" size="13" tabindex="1" onblur="jsf.util.chain(this,event,'mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputName\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputSname\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:inputDep\')','mojarra.ab(this,event,\'blur\',\'@this\',\'bde:reportErr\')')" type="text"></td>

Graphic differences between richfaces generated code and HTML: richfaces之间的图形差异生成代码和HTML:

在此输入图像描述在此输入图像描述

试试这个

<h:inputText value="test" disabled="disabled" style="background-color:blue; color:red;" />

reason, why I'm trying to change the background is, that since I've installed richfaces, disabled and enabled has the same color, both are white 原因,为什么我要改变背景是,因为我已经安装了richfaces,禁用和启用了相同的颜色,都是白色的

RichFaces ships with its own basic skinning . RichFaces有自己的基本皮肤 On RichFaces 4.0 you can disable it altogether by the following context parameters in web.xml . 在RichFaces 4.0上,您可以通过web.xml的以下上下文参数完全禁用它。

This disables the standard skin stylesheets (see chapter 6.6.1 of the linked developer guide) 这将禁用标准皮肤样式表(请参阅链接的开发人员指南的第6.6.1章)

<context-param>
    <param-name>org.richfaces.enableControlSkinning</param-name>
    <param-value>false</param-value>
</context-param>

This disables the component specific skin stylesheets (see chapter 6.6.2) 这将禁用特定于组件的外观样式表(请参阅第6.6.2章)

<context-param>
    <param-name>org.richfaces.enableControlSkinningClasses</param-name>
    <param-value>false</param-value>
</context-param>

If you however don't want to disable the basic skinning for some reason, but rather want to override specific CSS property/properties, then you need to specify exactly those property/properties in your own CSS. 但是,如果您因某些原因不想禁用基本外观,而是想要覆盖特定的CSS属性/属性,则需要在自己的CSS中准确指定这些属性/属性。 Using Firebug , you can rightclick the element of interest and choose Inspect Element to get all definied CSS properties in the right hand side of the bottom console. 使用Firebug ,您可以右键单击感兴趣的元素,然后选择Inspect Element以在底部控制台的右侧获取所有定义的CSS属性。

In this particular case, the input has a background-image property pointing to a particular URL. 在此特定情况下, input具有指向特定URL的background-image属性。 You need to override it like as follows: 您需要覆盖它,如下所示:

input { 
    background-image: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM