This question already has an answer here:
这个问题在这里已有答案:
- Style disabled button with CSS 8 answers
- 样式禁用按钮与CSS 8答案
- CSS selector for disabled input type=“submit” 3 answers
- 禁用输入类型的CSS选择器=“提交”3个答案
How can I select <button>
with the class list-group-item
and status disabled
in CSS ?
如何选择
<button class="list-group-item" disabled>...</button>
<button class="list-group-item">...</button>
Something like ?button.list-group-item:disabled
就像是 ? button.list组项目:禁用
Thanks.
谢谢。
2 个解决方案
#1
0
You can also do it with attribute selector:
您也可以使用属性选择器执行此操作:
.list-group-item[disabled] {
color:red;
}
<button class="list-group-item" disabled>Select me</button>
<button class="list-group-item">But no me</button>
#2
-1
You are right. To select a disabled element, use the disabled
selector:
你是对的。要选择已禁用的元素,请使用禁用的选择器:
:disabled {
css declarations;
}
#1
0
You can also do it with attribute selector:
您也可以使用属性选择器执行此操作:
.list-group-item[disabled] {
color:red;
}
<button class="list-group-item" disabled>Select me</button>
<button class="list-group-item">But no me</button>
#2
-1
You are right. To select a disabled element, use the disabled
selector:
你是对的。要选择已禁用的元素,请使用禁用的选择器:
:disabled {
css declarations;
}