Question: I'm using nsIStyleSheetService in my firefox extension to register a custom stylesheet for every webpage. Everything works great expect of some styles.

This is one of my styles that doesn't work. I've added a form with inputs / textareas but the look won't change. I tried adding important but it didn't work too. Any idea what I'm doing wrong?

After doing some tests I found out that the following styles doesn't work:

```
background-color:#f3f3ec;
border:1px solid #d1d1cf;
-moz-border-radius: 10px;

```

The strange thing is that it works when I load the css directly in the page but by using nsIStyleSheetService it doesn't work. I'm totally confused what's going on with it. :( 
I already tried setting the colors to something else but it didn't work too.

```
.MyToolTipWrapper input,
.MyToolTipWrapper textarea {
    background-color:#f3f3ec;
    border:1px solid #d1d1cf;
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    width:97%;
    padding:5px;
    -moz-border-radius: 10px;
}

```

My init script:

```
var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
var uri = makeURI("resource://newtooltip/newtooltip.css");
if (sss.sheetRegistered(uri, sss.USER_SHEET))
    sss.unregisterSheet(uri, sss.USER_SHEET);
if (on)
    sss.loadAndRegisterSheet(uri, sss.USER_SHEET);

```

Answer: 
CSS 2.1 [defines](http://www.w3.org/TR/CSS2/cascade.html#cascading-order) that user agent stylesheets have lower priority than the stylesheets defined by the web page - unless the `!important` keyword is used. In your case the web page probably defines a value for `background-color` already and it overrides the setting in your user stylesheet. You should use `!important` to make sure that your setting prevails:

```css
background-color:#f3f3ec !important;
border:1px solid #d1d1cf !important;
-moz-border-radius: 10px !important;

```
If you use `USER_SHEET` the CSS rules of the Website have higher priority than yours.
Try using `AGENT_SHEET`, so your CSS get higher priority.