我有一个以“chkboxlistnames”作为类的 ASP.NET 复选框列表:
<asp:CheckBoxList ID ="chkName" runat="server" RepeatDirection="Horizontal" CssClass="chkboxlistnames" >
<asp:ListItem Text="" Value="" ></asp:ListItem>
</asp:CheckBoxList>
我使用 jQuery、Ajax 和 JSON 方法填充此复选框。呈现 HTML 后显示如下:
<table id="MainContent_chkName" class="chkboxlistnames">
<tbody>
<tr>
<td>
<input id="MainContent_chkName_0" name="UserID" value="2009" type="checkbox">
<label for="MainContent_chkName_0">lekshmi@actsinfo.biz,Lekshmi</label>
</td>
</tr>
</tbody>
</table>
CSS:
input[type="checkbox"]:not(old) + label {
display: inline-block;
margin-left: -8px;
background: url('../img/checks.png') no-repeat 197px 1px;
line-height: 24px;
width: 222px;
text-align: left;
}
label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: 700;
}
此样式用于该应用程序中的所有复选框,但我想使用类 chkboxlistnames 为该复选框创建一个单独的 CSS,该怎么做?
最佳答案
chkboxlistnames
在父元素中,所以应该是这样的:
.chkboxlistnames input[type="checkbox"] {
//Your CSS goes here
}
关于html - 为输入类型复选框添加单独的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43775579/