[Python] Jupyter Notebook cell size width too long

Discussão em 'Python' iniciado por Stack, Maio 22, 2025.

  1. Stack

    Stack Membro Participativo

    How can I revert back to the original Jupyter Notebook display sizes? Today something happened and now the width of my cells when using Jupyter Notebook are extra large, I can't even see the scroll bar to the right anymore.

    [​IMG]

    I've tried many different tactics such as what was described in: Cell width Jupyter notebook - Apache Toree - Scala

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


    and

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


    and

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


    None worked.

    The below code was able to reflect some change, but not exactly what I wanted:

    [​IMG]

    from IPython.display import display, HTML

    display(HTML("""
    <style>
    /* For JupyterLab */
    .jp-Notebook {
    max-width: 80% !important;
    margin: auto !important;
    }
    </style>
    """))



    I also tried adding these configs as a custom.css file but that doesn't achieve what I want.
    I've also tried to reinstall everything:

    pip uninstall jupyter
    pip install jupyter
    pip uninstall ipython
    pip install ipython


    Still Jupyter Notebook is not looking correct.

    If I open these .ipynb files using Jupyter Lab it looks totally fine:

    [​IMG]

    Edit1: I'm running using Jupyter Version: 7.1.1

    Edit2: Here is an image showcasing same error in MS Edge: [​IMG]

    I now understand that the first tried solution from Cell width Jupyter notebook - Apache Toree - Scala is based on a old version of Jupyter, hence why I saw no results, the syntax for Jupyter 7 is what is what was described in the last example which did reflect changes.

    Continue reading...

Compartilhe esta Página