我有以下 HTML:
<div class="form">
<input disabled="disabled" data-ng-model="dataId" type="text" />
<div class="disabled input-type-text">123</div>
</div>
我正在尝试匹配禁用类别和输入类型文本。我尝试了以下但它不起作用:
.form .input-type-text.disabled ,
.form input.disabled,
.form input:disabled,
.form select.disabled,
.form select:disabled,
.form textarea.disabled {
color: #000000;
background-color: #e6e6e6;
border: 1px solid #adcede;
opacity: 0.5;
}
有人可以给我一些关于如何匹配 CSS 选择器的建议吗?请注意,这确实适用于 <input>
但不适用于 <div>
最佳答案
选择器是正确的:
.form .input-type-text.disabled {
border: 1px solid #adcede;
padding: 7px;
margin: 7px 0 2px 0;
line-height: 16px
}
问题是您没有关闭 style
属性中的 "
:
<div class="..." style="...ding: 7px; margin: 7px 0 2px 0; line-height: 16px></div>
<!-- Here ----------^ -->
关于html - 我如何使用 CSS 选择器来匹配存在的两个类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18295584/