css - 如何在 ASP.Net 中使用 CSS 设置 CheckBoxList 的样式?
问题描述
我CheckBoxList
在 ASP.Net 中有一个,我想更改选中的背景颜色Item
。
我该怎么做?
我想使用 CSS 来做到这一点。
我的.aspx
页面是:
<asp:CheckBoxList ID="chkdisease" runat="server" RepeatColumns="2">
<asp:ListItem> Spontaneous bleeding</asp:ListItem>
<asp:ListItem>chiae (superficial tiny areas of bleeding into the skin resulting in small reddish spots) , Purpura (easy or excessive bruising), Spontaneous bleeding from </asp:ListItem>
<asp:ListItem>Fatigue</asp:ListItem>
<asp:ListItem>Prolonged bleeding cuts,</asp:ListItem>
<asp:ListItem>DVT (deep vein thrombosi</asp:ListItem>
</asp:CheckBoxList>
解决方案
Css
代码来改变background-color
.
<style>
.MyClass input[type=checkbox]:checked + label
{
background-color:red;
}
</style>
并将课程应用于您的CheckBoxList
. 如下所示
<asp:CheckBoxList ID="chkdisease" runat="server" RepeatColumns="2" CssClass="MyClass">
<asp:ListItem> Spontaneous bleeding</asp:ListItem>
<asp:ListItem>chiae (superficial tiny areas of bleeding into the skin resulting in
small reddish spots) , Purpura (easy or excessive bruising), Spontaneous bleeding
from </asp:ListItem>
<asp:ListItem>Fatigue</asp:ListItem>
<asp:ListItem>Prolonged bleeding cuts,</asp:ListItem>
<asp:ListItem>DVT (deep vein thrombosi</asp:ListItem>
</asp:CheckBoxList>
推荐阅读
- wpf - 具有可变行/单元格类型的 WPF DataGrid - 重用模板
- java - 如何在 Android 项目中将文本的性别更改为语音?
- javascript - 如何在 Javascript 中获取对象名称?
- python - 我该如何解决这个项目的 shpe 和重新构建 CNN?
- pytorch - 功能线性层的大小不匹配
- reactjs - DigitalOcean 控制台服务器已断开连接
- r - 如何计算列中的值并将它们与特定行匹配?
- android - 无法从 ImageView [Kotlin] 中的 ActivityResult 设置位图
- rust - 如何干净地共享全局可变状态
- c# - 在 C# 中使用正则表达式获取实际的子字符串