Site logo

Archived topic

disable css on homepage

5 replies · Started by Den on June 20, 2022

Viewing posts 1–6 of 6

Hello Team,

I wonder if there's any way to disable a particular CSS code on the Homepage. I did some research and found that inserting a .page:not(.home) will do the task but unfortunately, this isn't working on my website.

The code I'm using:

@media (min-width: 1025px) { .page:not(.home) .site-content {
	margin-left: 28px;
	margin-right: -30px;
}
}

Waiting for your reply :)

Hi Den,

To clarify, are you wanting to exclude only the homepage for this CSS, and make it work on pages and posts? Or, just pages?

If it’s just pages, then that code should work. Can you try adding it, and I’ll see what’s occurring?

Hope to hear from you soon.

Hello Fernando,

Thanks for your reply.

Yes, You're right... I want to exclude only the homepage for this CSS, and make it work on the entire website.

I see. Thank you for clarifying.

If that’s the case, kindly modify your code into something like this:

@media (min-width: 1025px) {
    body:not(.home) .site-content {
        margin-left: 28px;
        margin-right: -30px;
    }
}

Kindly let us know how it goes.

As always... Great support!

It worked. Thanks Fernando have a great day.

You’re welcome Den! Hope you have a great day as well!

This archived topic is closed to new replies.