0

I've read through some similar questions, but can't quite work it out ... I've got simple Custom CSS on my WordPress site to increase the space under lists:

ol, ul {
  margin-bottom: 20px;
}

How do I exclude page ID 10875 from having that Custom CSS applied?

1
  • Assuming your template puts the page ID into a class on the body element as usual, something like body:not(.page-id-10875) ol, body:not(.page-id-10875) ul should probably work. Commented May 25, 2021 at 7:54

2 Answers 2

1

Starting from a body element in which the class is not .page-id-10875 you can specify any nested element with :is(<list of selectors>) or :where(<list of selectors>) pseudoclasses, e.g.

body:not(.page-id-10875) :where(ul, ol) {
   margin-bottom: 20px;
}
Sign up to request clarification or add additional context in comments.

6 Comments

Thank you Fabrizio! Unfortunately that had no effect.
Provide the actual code with the actual attribute on the body
Thank you Fabrizio. My page is here cell.bantergroup.com.au/sitemap
it perfectly works, of course you need to remove your rule or it will be applied
Is there a way to exclude a CSS file? @FabrizioCalderan
|
0
body:not(.exclude-page-id-class) ul,body:not(.exclude-page-id-class) ol {
 margin-bottom: 20px;
}

4 Comments

Thank you Sabih! Unfortunately that had no effect.
share demo example
Thank you Sabih. My page is here cell.bantergroup.com.au/sitemap
comment this ol, ul { margin-bottom: 20px; } and add body:not(.page-id-10875) :where(ul, ol) { margin-bottom: 20px; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.