Increase code font size in firefox developer tool

前端 未结 11 1897
别跟我提以往
别跟我提以往 2021-01-30 03:07

How to increase code fonts in Firefox developer tools? I know that there is a zoom function but I want to set the font size only for the code.

相关标签:
11条回答
  • 2021-01-30 03:20

    I accidentally had my firefox developer window resized to the minimum (couldn't even read it anymore), "CMD +" (mac) didn't work for me, well only for the main web page even if the console was focused, I just hit: "CMD 0" and it came back to normal, if it can be a good alternative to anyone else ;)

    0 讨论(0)
  • 2021-01-30 03:25

    Some elements of Firefox can be styled in the userChrome.css file situated in your Firefox profile's chrome folder.
    As of 2018, modify/create ~/.mozilla/firefox/[profile-name]/chrome/userChrome.css with something similar to:

    @-moz-document url-prefix("chrome://devtools/content/") {
        * { font-size: 13px !important; }
    }
    

    Then restart Firefox.

    The solution on the Mozilla forums almost has it right: https://support.mozilla.org/en-US/questions/1198481

    Using Ctrl+= or Cmd+= was not ideal for me since it increased fonts for all the elements of the window, including the tab names.

    Using .devtools-monospace { font-size: 13px !important;} was almost ok, but it did not affect the Debugger and Network tabs.

    Using @bohag_bihu's solution had side effects for the address bar and some other text inputs.

    0 讨论(0)
  • 2021-01-30 03:27

    So sure, as stated before, the short answer is cmd++.

    But the + sign might not be directly accessible on your keyboard (no numeric key pad, laptop, strange layout).
    You then have to press maj first to access the + sign, like, for example on the american keyboard layout: maj+=.
    Unfortunately, even if you are correctly focused on the dev tool pane, cmd+maj+= increases the font of the web view pane, while cmd+- decreases the font on the dev tool pane.
    And you end-up with a web tool pane with a font size so small that it is unreadable, and no way to increase it.

    Then @Thal's answer comes handy, once focused to the dev tool pane cmd+0 resets the dev tool's font size to the original.

    If you want to answer the question like @Timothy_Truckle is asking for, here are a couple of them (still focus on the dev tool pane, of course):

    • switch to the US keyboard layout and press cmd+=
    • find a keyboard layout with the + directly accessible, switch to it, and press cmd++

    That's for you guys wondering why some find it hard to simply press cmd++ or why some find it hard to focus on the dev tool pane (because they actually focus on the dev tool pane, but the result is as if they were focused on the web view pane).

    0 讨论(0)
  • 2021-01-30 03:29

    You need to modify userChrome.css under ~/.mozilla/firefox/[profile-name]/chrome with this:

    /*  Styles for Web developer tools */
    @namespace url(http://www.w3.org/1999/xhtml);
    .CodeMirror {
        font-family:    "Ubuntu Mono", monospace !important;
        font-size:      15pt !important;
    }
    

    The result looks like this:

    firefox

    This only changes the debugger and style editor. There's a different selector for the html inspector. Not sure what that is yet.

    0 讨论(0)
  • 2021-01-30 03:29

    You can specify a style for the devtools-monospace class selector. To do so, edit userChrome.css in your mozilla profile's chrome directory, and specify the CSS properties you want. For example:

    .devtools-monospace {
        font-family: "Source Code Pro",monospace !important;
        font-size: 16px !important;
    }
    

    The userChrome.css needs to be in the chrome folder of your Firefox profile. If the folder don't exist, create it. Your userChrome.css will then override the CSS from Firefox dev tools after you restart the browser.

    To find your profile in Windows OS type: Strg + R and then enter:

    %APPDATA%\Mozilla\Firefox\Profiles\
    
    0 讨论(0)
  • 2021-01-30 03:32

    This one works on FF 68 Linux with userChrome.css. I think inspector tools are now using CSS variables and the inspector tree itself is loaded in an iframe so none of the tweaks actually worked esp. with .CodeMirror classes.

    You can find all the variables in this file (just copy paste below URL in FF to view source)

    resource://devtools/client/themes/variables.css
    

    For the userChrome.css part here's what solved it for me.

    /* @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); */
    
    :root {
      /* Text sizes */
      --theme-code-font-size: 13px !important;
    }
    
    0 讨论(0)
提交回复
热议问题