CSS不适用于启用的文本框=否 [英] Css not working for textbox enabled = false

查看:99
本文介绍了CSS不适用于启用的文本框=否的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

当我设置textbox.Enabled = false时;它失去了CSS的所有样式.

但是我可以设置textbox.Readonly = true,并且来自CSS的样式效果很好.

如何从CSS为禁用的文本框设置样式?

非常感谢.

Dear all,

When I set my textbox.Enabled = false; it lose all style from css.

But I can set textbox.Readonly = true, and style from css works well.

How can I set style from css for disabled textbox?

Thanks very much.

推荐答案

谢谢,我找到了解决方案.
当我设置Enabled = false时,没有CSS样式适用.
但是当我将disabled设置为true时,它就可以正常工作.
例题
Thanks all, I found the solution to do it.
There are no CSS style apply when I set Enabled=false.
But when I set disabled=true, it works well.
Exampe
<textbox txttest="" class="test" disabled="true"></textbox>


非常感谢,

它对txtClass:readonly非常有效.
但是它不适用于txtClass:disabled.
我尝试了txtClass [disabled],但它也无法正常工作.
Thanks very much,

It works well for txtClass:readonly.
But it doesn''t work for txtClass:disabled.
I tried txtClass[disabled] but it doesn''t work too.




您需要明确指定禁用文本框的样式,如下所示:

假设文本框的css类是txtClass,并且具有背景色:黄色.

然后这些就是您需要放在样式表中的类:


Hi,

You need to specify the styles for disabled text box explicitly as follows:

Suppose the css class of your textbox is txtClass and it has background color : yellow.

Then these will be the classes you need to put in style sheet:


.txtClass 
{
 background-color:yellow;
}

.txtClass :disabled
{
 background-color:yellow;
}


这篇关于CSS不适用于启用的文本框=否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆