isx*_*ker 51 css internet-explorer input
我需要在CSS中更改禁用的输入元素的样式.
<input type="text" class="details-dialog" disabled="disabled" />
Run Code Online (Sandbox Code Playgroud)
我如何为Internet Explorer执行此操作?
thi*_*dot 46
你不能用于Internet Explorer.
看到我在相关主题上写的这篇评论:
似乎没有一个好方法,请参阅: 如何使用css更改IE8中禁用的html控件的颜色 - 您可以将输入设置为
readonly
相反,但这有其他后果(例如readonly
,input
将被发送到服务器提交,但有disabled
,它不会是):http://jsfiddle.net/wCFBw/40
另请参阅:更改IE中禁用的文本框中的字体颜色
Ale*_* K. 40
您可以:
input[type="text"][disabled] {
color: red;
}
Run Code Online (Sandbox Code Playgroud)
小智 19
以下内容让您在IE8中非常接近,并且也适用于其他浏览器.
在你的HTML中:
<input type="text"
readonly="readonly" <!-- disallow editting -->
onfocus="this.blur();" <!-- prevent focus -->
tabindex="-1" <!-- disallow tabbing -->
class="disabledInput" <!-- change the color with CSS -->
/>
Run Code Online (Sandbox Code Playgroud)
在你的CSS中:
.disabledInput {
color: black;
}
Run Code Online (Sandbox Code Playgroud)
在IE8中,悬停时会有少量边框颜色变化.input.disabledInput的一些CSS:hover可能会解决这个问题.
小智 8
disabled
用。。。来代替readonly="readonly"
。我认为这是相同的功能。
<input type="text" class="details-dialog" readonly="readonly" style="color: ur color;">
Run Code Online (Sandbox Code Playgroud)
小智 7
input[disabled], input[disabled]:hover { background-color:#444; }
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
179255 次 |
最近记录: |