admin管理员组

文章数量:1394228

I have a universal CSS rule in my stylesheet like this:

#page.grid-parent {
  padding-left: 20px;
  padding-right: 20px
}

What I'd like to do is REMOVE that rule from some Custom Taxonomy Archive Pages I have.

So, if I look at the body tag of an example page I see this:

<body class="archive tax-country term-saudi-arabia term-445 wp-custom-logo wp-embed-responsive cookies-set cookies-accepted post-image-below-header post-image-aligned-center no-sidebar nav-float-right fluid-header separate-containers active-footer-widgets-0 header-aligned-left dropdown-hover elementor-default" itemtype="" itemscope>

I am sure that I can use the "tax-country" as the hook to hide that CSS rule.

To hide the CSS rule from those pages I tried this:

#page.grid-parent.tax-country {
  padding-left: 0px;
  padding-right: 0px
}

....and it didn't work...

I also tried to use the #tax-country ID like this:

#tax-country.grid-parent {
  padding-left: 0px;
  padding-right: 0px;
}

And still no joy...

I have a universal CSS rule in my stylesheet like this:

#page.grid-parent {
  padding-left: 20px;
  padding-right: 20px
}

What I'd like to do is REMOVE that rule from some Custom Taxonomy Archive Pages I have.

So, if I look at the body tag of an example page I see this:

<body class="archive tax-country term-saudi-arabia term-445 wp-custom-logo wp-embed-responsive cookies-set cookies-accepted post-image-below-header post-image-aligned-center no-sidebar nav-float-right fluid-header separate-containers active-footer-widgets-0 header-aligned-left dropdown-hover elementor-default" itemtype="https://schema/Blog" itemscope>

I am sure that I can use the "tax-country" as the hook to hide that CSS rule.

To hide the CSS rule from those pages I tried this:

#page.grid-parent.tax-country {
  padding-left: 0px;
  padding-right: 0px
}

....and it didn't work...

I also tried to use the #tax-country ID like this:

#tax-country.grid-parent {
  padding-left: 0px;
  padding-right: 0px;
}

And still no joy...

Share Improve this question asked Feb 10, 2020 at 23:07 HenryHenry 9831 gold badge8 silver badges31 bronze badges 1
  • How about body.tax-country #page.grid-parent ? But CSS questions like this is better asked on Stack Overflow. – Sally CJ Commented Feb 10, 2020 at 23:56
Add a comment  | 

1 Answer 1

Reset to default 0

You can try this below CSS. I think, It will work.

.tax-country #page.grid-parent {
  padding-left: 0px;
  padding-right: 0px
}

本文标签: Removing a CSS rule from Custom Taxonomy