Page 1 of 1

Can you stop a CSS class on a particular URL?

Posted: Mon Aug 07, 2017 11:06 am
by simonmlewis
Is there a way in a CSS class, to say if URL does not contain /blog, then do this.... ?

We have a full width category page which is perfect in Wordpress, but it is also assigning that class width to the Blogs. We want the Blog to not be full width.

So I wondered if it can be set to

Code: Select all

body .archive .grve-container,#disqus_thread,#grve-content.grve-left-sidebar .grve-content-wrapper,#grve-content.grve-right-sidebar .grve-content-wrapper
{
    max-width: 89%!important;
    margin-right: auto;
    margin-left: auto;
}
.... when URL does not have /blog/ in it.

Re: Can you stop a CSS class on a particular URL?

Posted: Mon Aug 07, 2017 10:59 pm
by requinix
You can't have CSS target a URL.

If your next thought is about using classes or adding some CSS just for blog pages then you're on the right track.

Re: Can you stop a CSS class on a particular URL?

Posted: Wed Oct 18, 2017 8:14 am
by baldwinjackson
I guess there is 2 approach to do so. 1 you can assign a specify class on blog pages by over riding the blog function.php file then write the code in style.css file. If the pages are few like 2-3 then you pick page-id and apply the css on page-id:

#page-id .anyclass > .other > .finalclass

Cheers!

Re: Can you stop a CSS class on a particular URL?

Posted: Wed Oct 18, 2017 7:02 pm
by Weirdan
You can't have CSS target a URL.
Unless there's some JS that adds CSS classes based on the URL, like Modernizr does based on browser features.