css - IPython笔记本设置笔记本面板(网页)的宽度

标签 css width jupyter-notebook

我想将 IPython 笔记本的宽度设置为 2500px,并且希望它左对齐。我怎样才能做到这一点?

我使用此代码来应用我自己的 CSS:

from IPython.core.display import HTML
def css_styling():
    styles = open("./example.css", "r").read()
    return HTML(styles)
css_styling()

我的 CSS 内容是:

<style>
div #notebook { /* centre the content */
    float: left;
    width: auto;}
div #notebook_panel { /* main background */
    float: left;
    width: auto;}
div.cell { /* set cell width to about 80 chars */
    width: 2000px;}
</style>

如果我使用此 CSS 运行 IPython 脚本,那么我的笔记本网页将向左对齐,单元格的宽度为 2000 像素,但网页将变为可水平滚动的尺寸约为 1000 像素。所以只有前半部分的单元格可见。

如果我在 #notebook#notebook_panel 设置 width: 2500px; ,那么水平滚动就会消失,因此笔记本网页宽度将宽度为 2500 像素,我看到充满了单元格,但对齐方式将居中。为什么?

我也在 Firefox 和 Chrome 中尝试过。

感谢您的帮助!

最佳答案

解决方案如下:How do I increase the cell width of the Jupyter/ipython notebook in my browser?

<style>
.container { width:100% !important; }
</style>

关于css - IPython笔记本设置笔记本面板(网页)的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28234411/

相关文章:

python - 在 databricks 笔记本中导入 Python 文件

html - 以非网格方式定位图像

html - Logo 大小似乎在 html 和 css 中缩小

c# - 如何将 css 添加到 asp.net web 应用程序

r - 改变 R 条形图的宽度

jquery - 动画最后闪烁

jupyter-notebook - 在 Ubuntu Linux 20.04 上彻底卸载并重新安装 Jupyter-Lab 和 ipyleaflet 的步骤

jupyter-notebook - 无法显示类型为 HBox 的 Jupyter Widget;小部件 JavaScript 库丢失?

php - 如何创建固定表头

css - 尝试获取 CSS3 中两个值的最小和最大大小