[Project_owners] CSS and browser windows

Philip Chee philip.chee at gmail.com
Thu Jan 19 09:03:04 EST 2006

On Wed, 18 Jan 2006 14:52:43 -0800, HJ wrote:
> Adam Judson wrote:
>> I have a few browser (content) windows in my extension's xul window.
>> Does anyone know how to override styles picked up from
>> resource://gre/res/html.css?

> var _nsIStyleSheetService = 
> Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
> var _nsIIOService = 
> Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
> var htmlCSS = 
> _nsIIOService.newURI("chrome://[chrome-name]/content/html.css", null, null);
> _nsIStyleSheetService.loadAndRegisterSheet(htmlCSS, 
> _nsIStyleSheetService.USER_SHEET);

1. He seems to want to override the styles only within the content of his
own <browser> elements.

2. nsIStylesheetService affects both chrome and content, so you will
probably need to use a @namepace() declaration in your .css file.

Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]Riker to Enterprise.  Beam down Troi and a six-pack.
* TagZilla 0.059

More information about the Project_owners mailing list