How to Increase the Cell Width of Jupyter/IPython Notebook in Your Browser
Jupyter/IPython notebooks are a popular tool among data scientists for developing, documenting, and sharing their work. One common issue that arises when working with these notebooks is the default cell width, which can often be too narrow, making it difficult to read or write long lines of code.
In this blog post, I’ll walk you through several methods to increase the cell width of Jupyter/IPython notebooks in your browser. This will help you to improve readability and make the most out of your screen real estate.
Table of Contents
Method 1: Create a Custom CSS File
Another way to increase cell width in Jupyter notebooks is by creating a custom CSS file. This method allows you to set the cell width for all notebooks globally. To do this, follow these steps:
Initial Jupyter cell width
- Locate the Jupyter configuration directory on your system. You can do this by running the following command in your terminal or command prompt:
jupyter --config-dir
- In the configuration directory, create a subdirectory called
custom
if it doesn’t already exist. - Inside the
custom
directory, create a new file namedcustom.css
. - Open
custom.css
in your favorite text editor, and add the following CSS code:
.container {
width: 100% !important;
}
.cell {
width: 100%;
}
.code_cell {
width: 100%;
}
- Save the file and restart your Jupyter notebook server.
Now, all your Jupyter notebooks will have their cell width set to 100% of the available screen width.
Method 2: Use Browser Developer Tools
A quick and temporary way to increase cell width in a Jupyter notebook is by using your browser’s developer tools. This method is useful if you just need to make a quick change and don’t want to modify any files. Here’s how to do it:
- Open your Jupyter notebook in your browser.
- Right-click on the cell you want to modify and select
Inspect
orInspect Element
, depending on your browser.
- In the developer tools window, locate the
.cell
or.code_cell
CSS class. - Modify the
width
property to your desired value, such as100%
.
This method only applies the changes to the current notebook session, and the changes will be lost when you refresh the page or close the browser.
Conclusion
In this blog post, we’ve covered two methods to increase the cell width of Jupyter/IPython notebooks in your browser. Give one or more of these methods a try to improve readability and make the most out of your screen real estate. Happy coding!
About Saturn Cloud
Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.
Saturn Cloud provides customizable, ready-to-use cloud environments for collaborative data teams.
Try Saturn Cloud and join thousands of users moving to the cloud without
having to switch tools.