2

I want to apply CSS to all pages except sidebars. Let me show you an example

.page #buddypress ul.group li

I want to apply CSS to all <li> tags that are children of ul.group class. Problem here is that this class is also exist in sidebar and I don't want to change styling of sidebar. I just want to apply CSS to the page section and not to the sidebar.

I except some kind of :not(.class) operation to do that.

Here is what I am trying to do

.page :not(.sidebar) #buddypress ul.group li

But this trick doesn't work for me. I really appreciate if someone could solve my problem. I want to apply CSS to all sections except sidebar.

Here is what my HTML looks like:

<body>
<div id="buddypress">
<ul class="groups">
<li> </li>
</div>
<div class="sidebar">
<ul class="groups">
<li> </li>
</div>
a stone arachnid
  • 1,272
  • 1
  • 15
  • 27
Neeraj
  • 652
  • 10
  • 18
  • 3
    How does your HTML look? It's hard to know what to do, if we don't know the code :-) – razemauze Apr 24 '18 at 07:41
  • please add your HTML code here. So, we can help you better... – RAJNIK PATEL Apr 24 '18 at 07:42
  • Note that by using `.page :not(.sidebar) #buddypress li` you are saying `select
  • s that have any element between .page and #buddypress without class .sidebar`. You could replace it with e.g. `.page :not(.sidebar) > #buddypress li`, depending on how your HTML looks. Paste it here and we may be able to help out more
  • – elveti Apr 24 '18 at 07:47