How to get Firefox to show XML document trees in a monospace font

I would like Firefox to display XML document trees in a monospace font, instead of using the default proportional serif font.

For a single document I can do this from the menu View->Page Style->Monospace, but it falls back to the default if I reload the document or fetch a new one.

Is there a way to permanently change the font used for rendering XML document trees in Firefox without affecting the way non-XML documents are rendered?


Solution 1:

Note: The following solution will also affect the View Source browser.

  1. Edit the file C:\Program Files\Mozilla Firefox\res\viewsource.css
  2. Add the line font-family: monospace; to the *|*:root block.
  3. Restart Firefox.

Example (truncated file):

...
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */

*|*:root {
  background-color: white;
  color: black;
  font-family: monospace;
}
...