本文介绍了如何在样式表中使用不带css选择器的*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 这是我的问题: 我有外部样式表我有*选择器定义为: * { margin : 0em 4.2 em 0em 0em; padding : 0em; } 现在在我的aspx页面中,我有一个树形视图控件。由于上面的选择器,我的树视图没有正确显示。 这是代码 < div id = treeview 样式 = padding-removed250px; padding-removed150px; width :1040px; margin-removed495px; > < asp:TreeView ID = TreeView1 runat = server ShowLines = true SelectedNodeStyle-ForeColor = 绿色 CssClass = TreeViewClass 样式 = margin:0em 0em 0em 0em!important; SelectedNodeStyle-VerticalPadding = 0 目标 = _ blank > < / asp:TreeView > < / div > 因此,通过从*选择器中删除边距,它正常工作但其他元素受到干扰。所以我在TreeView控件中添加了Style属性,即内联。但它不起作用。我也试过为treeview制作一个不同的cssclass,但是对我没有帮助。 我也试过使用css的not选择器但是这对我不起作用。 我需要你的帮助。我应该怎么做才能保持这些风格?解决方案 我得到了解决方案 http: //stackoverflow.com/questions/31709970/how-to-use-not-css-selector-with-in-stylesheet Hi All,Here is my problem:I have External Style Sheet in which I have "*" selector which defines as:*{margin: 0em 4.2em 0em 0em;padding: 0em;}Now in my aspx page I have a tree view control. Because of the above selector my tree view is not showing properly. Here is the code<div id="treeview" style="padding-removed250px; padding-removed150px; width:1040px;margin-removed495px;"> <asp:TreeView ID="TreeView1" runat="server" ShowLines="true" SelectedNodeStyle-ForeColor="Green" CssClass="TreeViewClass" Style="margin: 0em 0em 0em 0em !important;" SelectedNodeStyle-VerticalPadding="0" Target="_blank"> </asp:TreeView> </div>So by removing the margin from "*" selector it is working properly but other elements are getting disturbed. So I have added the Style attribute in the TreeView control i.e. inline. But It is not working. I have also tried making a different cssclass for treeview but does not help me.I have also tried using the not selector of css but that doesn't work for me. Please I need your help. What should I do to keep these both styling? 解决方案 I got the solution"http://stackoverflow.com/questions/31709970/how-to-use-not-css-selector-with-in-stylesheet" 这篇关于如何在样式表中使用不带css选择器的*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-22 04:46