Overriding a global CSS in stylish

I'm using Stylish on Slimjet, which is a nice Chrome derivative browser.
I'm trying to use a default CSS to make some basic changes, such as font family. I set it to the regex ".*", and it seems to be catching all pages.

The problem is that some of the elements of the global css conflict with CSS's of a few individual sites. These are sites that I assign another local CSS to.

So, is there a way to keep the global CSS, but to give it less priority than other CSS's I employ? All the elements in question on both CSS's use the "!important" parameter, otherwise they wouldn't work much of the time.

Thanks,
Paul

Comments

  • Your styles should work together according to CSS's cascade rules. If you provide the full code of your global style and some examples of stuff it's overriding, I can be more specific.
  • Ok, thanks. I found that I had an copy/paste error in the site-specific CSS that was mimicking the global CSS, making me think the global was running things. When I corrected the site-specific CSS the problem disappeared. So this one is on me.

    I still don't know how Stylish knows which CSS spec to use, but I guess I'll figure that out if another problem arises.

    Thanks much for your input!


  • Stylish uses whatever CSS the browser it's running in uses.
  • But if there are two CSS's that pertain to a site, which CSS rules? That was the issue I thought I had here.
  • Stylish styles are "author" styles and if everything is !important, the pertinent section of the spec is http://www.w3.org/TR/CSS2/cascade.html#specificity
  • Thanks, I did see that. The selector and attributes of the two CSS's are exactly the same specificity, I believe. An example:

    a[href*="nytimes.com"], a[href*="www.washingtonpost.com"], a[href*="abcnews.go.com"] {color: #CC0E86 !important; }

    The colors only differ between the two CSS's. I wonder if Stylish has an order of its own, say particular CSS's over globals. Otherwise I don't know why the existing arrangement is working.

    If I ever do get a conflict, I guess I would try to place with specificity to work it out.\\
  • The order in which Stylish will insert the styles is not defined, so you shouldn't rely on it.
  • Ok, thanks. I'll just play this by ear. Blessings.
Sign In or Register to comment.