I have a set of Jupyter Notebooks that I store on GitHub so that users can access them through Binder.

I would like to reduce the font size of the output of code blocks for the user. All information I can find on changing the font size, including on Stack Overflow, relates to changing the custom.css file. This file changes what I see in my own browser, but it is not part of the repo, cannot be pushed to GitHub, and is not served by Binder, so altering this file does nothing for what my users see.

Is there a way to change the output font size that's native to the notebook itself and would therefore survive being channeled through GitHub and Binder?

This is Jupyter Notebook 5.4.0.


Add this to all notebooks as the LAST cell. Because javascript used the users must have trusted the notebooks.

$('.output_result').css('font-size', '5pt')

Users should be able to change the font size according to their visual capabilities. Give users the instructions to install jupyter_contrib_nbextensions and to enable the Code Font Size extension: https://github.com/ipython-contrib/jupyter_contrib_nbextensions

  • Could you possibly quote the relevant sections from your link? This is in case the URL is removed in the future. – Burgi Sep 27 '19 at 14:02
  • Thank you! I know and respect the Stack Exchange board rules. However, the link refers to a well-known, "latest", public and static target. The instructions are extensive and by the jupyter_contrib_nbextensions developer. It is not my place to decide on relevant sections there. – SkatEddy Sep 27 '19 at 14:48
  • This is a vastly unreasonable thing for me to ask my users to do. It requires the user to install pip and jupyter, for example, which defeats the entire purpose of serving the notebooks through Binder. – Borea Deitz Oct 4 '19 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.