📣 Introducing $2.95/Hr H100, H200, B200s, and B300s: train, fine-tune, and scale ML models affordably, without having to DIY the infrastructure   📣 Run Saturn Cloud on AWS, GCP, Azure, Nebius, Crusoe, or on-prem. 📣 Introducing $2.95/Hr H100, H200, B200s, and B300s: train, fine-tune, and scale ML models affordably, without having to DIY the infrastructure   📣 Run Saturn Cloud on AWS, GCP, Azure, Nebius, Crusoe, or on-prem. 📣 Introducing $2.95/Hr H100, H200, B200s, and B300s: train, fine-tune, and scale ML models affordably, without having to DIY the infrastructure   📣 Run Saturn Cloud on AWS, GCP, Azure, Nebius, Crusoe, or on-prem.
← Back to Blog

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.

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

Jupyter Normal Width

  1. 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
  1. In the configuration directory, create a subdirectory called custom if it doesn’t already exist.
  2. Inside the custom directory, create a new file named custom.css.
  3. 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%;
}
  1. Save the file and restart your Jupyter notebook server.

Jupyter Full Width

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:

  1. Open your Jupyter notebook in your browser.
  2. Right-click on the cell you want to modify and select Inspect or Inspect Element, depending on your browser.

Jupyter Inspect

  1. In the developer tools window, locate the .cell or .code_cell CSS class.
  2. Modify the width property to your desired value, such as 100%.

Jupyter Inspect Width

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!

Keep reading

Related articles

How to Increase the Cell Width of Jupyter/IPython Notebook in Your Browser
Dec 29, 2023

How to Resolve Memory Errors in Amazon SageMaker

How to Increase the Cell Width of Jupyter/IPython Notebook in Your Browser
Dec 22, 2023

Loading S3 Data into Your AWS SageMaker Notebook: A Guide

How to Increase the Cell Width of Jupyter/IPython Notebook in Your Browser
Dec 19, 2023

How to Convert Pandas Series to DateTime in a DataFrame