Is there a CSS selector for disabled input type="submit"
or "button"
?
是否有CSS选择器用于禁用的输入类型="submit"或"button"?
Should I just use input[type="submit"][disabled]
?
我应该只使用input[type="submit"][disabled]吗?
Does that work in IE6?
这在IE6中有用吗?
3 个解决方案
#1
99
Does that work in IE6?
这在IE6中有用吗?
No, IE6 does not support attribute selectors at all, cf. CSS Compatibility and Internet Explorer.
不,IE6根本不支持属性选择器、CSS兼容性和Internet Explorer。
You might find How to workaround: IE6 does not support CSS “attribute” selectors worth the read.
您可能会发现如何处理:IE6不支持CSS“属性”选择器。
EDIT
If you are to ignore IE6, you could do (CSS2.1):
如果要忽略IE6,可以编辑(CSS2.1):
input[type=submit][disabled=disabled],
button[disabled=disabled] {
...
}
CSS3 (IE9+):
IE9 CSS3(+):
input[type=submit]:disabled,
button:disabled {
...
}
You can substitute [disabled=disabled]
(attribute value) with [disabled]
(attribute presence).
您可以将[disabled=disabled](属性值)替换为[disabled](属性存在)。
#2
1
As said by jensgram, IE6 does not support attribute selector. You could add a class="disabled" to select the disabled inputs so that this can work in IE6.
正如jensgram所说,IE6不支持属性选择器。您可以添加一个class="disabled"来选择禁用的输入,以便在IE6中使用。
#3
0
I used @jensgram solution to hide a div that contains a disabled input. So I hide the entire parent of the input.
我使用@jensgram解决方案来隐藏包含禁用输入的div。我隐藏了输入的整个父元素。
Here is the code :
这里是代码:
div:has(>input[disabled=disabled]) {
display: none;
}
Maybe it could help some of you.
也许对你们有些人有帮助。
#1
99
Does that work in IE6?
这在IE6中有用吗?
No, IE6 does not support attribute selectors at all, cf. CSS Compatibility and Internet Explorer.
不,IE6根本不支持属性选择器、CSS兼容性和Internet Explorer。
You might find How to workaround: IE6 does not support CSS “attribute” selectors worth the read.
您可能会发现如何处理:IE6不支持CSS“属性”选择器。
EDIT
If you are to ignore IE6, you could do (CSS2.1):
如果要忽略IE6,可以编辑(CSS2.1):
input[type=submit][disabled=disabled],
button[disabled=disabled] {
...
}
CSS3 (IE9+):
IE9 CSS3(+):
input[type=submit]:disabled,
button:disabled {
...
}
You can substitute [disabled=disabled]
(attribute value) with [disabled]
(attribute presence).
您可以将[disabled=disabled](属性值)替换为[disabled](属性存在)。
#2
1
As said by jensgram, IE6 does not support attribute selector. You could add a class="disabled" to select the disabled inputs so that this can work in IE6.
正如jensgram所说,IE6不支持属性选择器。您可以添加一个class="disabled"来选择禁用的输入,以便在IE6中使用。
#3
0
I used @jensgram solution to hide a div that contains a disabled input. So I hide the entire parent of the input.
我使用@jensgram解决方案来隐藏包含禁用输入的div。我隐藏了输入的整个父元素。
Here is the code :
这里是代码:
div:has(>input[disabled=disabled]) {
display: none;
}
Maybe it could help some of you.
也许对你们有些人有帮助。