Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How Do I Stop a CSS Style from Affecting Some Sites? Reply To: How Do I Stop a CSS Style from Affecting Some Sites?

#189808
Alen
Participant

I wouldn’t start changing anything in the global style sheet. Instead override the style by adding a hook (another CSS class) to HTML so that you can target that specific element. In WordPress for example the body element usually has classes attached to it specific to what is being viewed… posts for example have ID’s if you need to target any individual post.

It would help if we can see sample code, instead of talking about it in abstract.

In short in would look like this:


/* Global Styles */
.my-global-element{ color:red; }

/* Custom Styles */
.about-page .my-global-element { color:green; }
.contact-page .my-global-element { color:blue; }

http://codepen.io/alenabdula/pen/ByoxRO