Asp.net 在树视图上设置复选框的样式

Asp.net 在树视图上设置复选框的样式,asp.net,treeview,Asp.net,Treeview,我有一个包含树视图的div,如下所示: <div style="position: relative; left: 0px; top: -160px;" class="TreeView"> <asp:TreeView ID="TreeView1" runat="server" ImageSet="Simple" ShowLines="True" ShowCheckBoxes="All"> </asp:TreeView> </div>

我有一个包含树视图的div,如下所示:

<div style="position: relative; left: 0px; top: -160px;" class="TreeView">
    <asp:TreeView ID="TreeView1" runat="server" ImageSet="Simple" ShowLines="True" ShowCheckBoxes="All">
    </asp:TreeView>
</div>
我的复选框以我想要的方式显示,但实际上我希望TreeView中的所有复选框具有相同的样式,我已尝试:

.TreeView.input[type="checkbox"] {
    margin: 0;
    padding: 0;
    width: 10px;
}

但它不起作用。我做错了什么?

好吧,从你的代码中我可以说你应该编写以下CSS

.TreeView input[type="checkbox"] {
    margin: 0;
    padding: 0;
    width: 10px;
}

使用空格字符获取子成员。如果浏览器中的
TreeView
ID是
cpMainContent\u TreeView1
,请尝试此操作:

#cpMainContent_TreeView1 input[type="checkbox"] {
    margin: 0;
    padding: 0;
    width: 10px; 
}

杰出的非常感谢。出于兴趣,您知道我尝试的
.TreeView.input[type=“checkbox”]
是否无效,或者它是否做了我不期望的事情吗?欢迎您
#
在我们通过ID获取时使用,而
在我们通过类获取时使用。您是否可能有其他CSS覆盖它?尝试使用chrome开发者工具来检查元素,看看是否有什么东西覆盖了它。对不起,我刚刚调整了我的注释。因为有了阿沙德的回答,我不需要在分区上课,所以把它拿出来。当然,你的答案需要在那里上课。道歉。
#cpMainContent_TreeView1 input[type="checkbox"] {
    margin: 0;
    padding: 0;
    width: 10px; 
}