Increase the cell width of the Jupyter Notebook in browser

How to increase the cell width of the Jupyter Notebook in browser ?

This tutorial guides you on how to increase the cell width of the Jupyter Notebook in browser. A Jupyter Notebook cell is called as code cell which will allow you to edit and write a new code. When the code cell that contains code is run, it will be sent to the IPython kernel installed in the notebook environment and executed.

Increase the cell width of the Jupyter Notebook in browser

Let’s say if you have a higher resolution screen and you see extra space around as shown in the screenshot below. Therefore, you would like to expand he cell width to make use of the extra space.

Increase the cell width of the Jupyter Notebook in browser

 

Note, the theme I am using for notebook interface is the default one with default settings. If you wanted to change only the width of the notebook cell, you just need the enter the following code in the cell to resize the cell width.

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

For instance, after entering the above code in the cell, just hit “Run“. Finally, you could see the you are able to increase the cell width of the Jupyter Notebook in browser.

increase cell width jupyter notebook python

 

Increase the cell width of notebook using custom css

Alternative way to increase the cell width is to create/ edit css file as explained below.

Go the following location

C:\Users\<profile_account>\.jupyter\custom

If you find custom.css in that location then edit to add the following content or create a file called custom.css with the content below.

custom.css

.container { width:100% !important; }

Note, this file contains any manual css for the notebook interface page that needs to override the global styles. This is only required when different pages style the same element differently. This is just a hack to deal with your current CSS style. And no new styling should be added to this file.

Finally, reload the page of jupyter notebook interface. Note, this will affect all the notebooks.

That’s it. Hope it helped 🙂

You’ll also like:

References

 

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments