How do I increase the cell width of the Jupyter version 7
Asked Answered
J

3

6

I'd like to increse the cell width of the jupyter notebook 7. I used below code in notebook 6, but it doesn't work in version 7.0.2.

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

Thank you

I want to increase jupyter notebook cell width.

Jennet answered 3/9, 2023 at 0:50 Comment(1)
Try jupyterlab for wider cell width. There is a button for jupyterlab on the left of menu.Skivvy
S
5

The notebook v7 cell width depends on the padding of notebook element, which's property is set as calc(calc(100% - var(--jp-notebook-max-width)) * 0.5);

Override the property --jp-notebook-max-width by adding custom css.

.jp-Notebook {
  --jp-notebook-max-width: 98%;
}

about custom.css Applying custom css

Strudel answered 17/9, 2023 at 13:17 Comment(0)
R
4

I believe this is the simple solution you are looking for (just run it in the starting cell as you used to do for the previous version to increase the cell width):

# Works in Jupyter Notebook version 7.0.8
from IPython.display import display, HTML
display(HTML("<style>.jp-Cell { margin-left: -20% !important; margin-right: -15% !important; }</style>"))

Adjust the percentages according to your screen size...

Rumelia answered 16/5 at 5:6 Comment(1)
This was answered by me from a different profile which was deleted and later merged, how can I show my name here and edit the response?Leyte
G
0

I've written -

.jp-Notebook {
  --jp-notebook-max-width: 95%;
}

@media (min-width: 1600px) {
  .jp-Notebook {
    --jp-notebook-max-width: 78%;
  }
}

in ~/.jupyter/custom/custom.css have some custom width based on browser width

Goles answered 16/6 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.