如何在浏览器中消除Jupyter/ipython笔记本周围的灰色边框?

Luk*_*vis 5 html css python ipython-notebook jupyter-notebook

我在这个帖子中读到了如何更改Jupyter笔记本的单元格宽度(我使用了第二个答案来动态地这样做).此方法消除了左右灰色边框.

但是,这仍然在文档的顶部和底部留下灰色边框.我怎样才能删除它,以便细胞躺在干净的石板上?

Luk*_*vis 9

更新2019/02/18:我建议安装,而不是执行以下操作jupyterthemes.这些笔记本主题非常棒,漂亮且易于使用,并且消除了灰色边框.


原帖:

因此,在笔记本上使用"Inspect Element"并学习CSS的iota后,以下内容似乎可行

from IPython.core.display import display, HTML
display(HTML("<style>"
    + "#notebook { padding-top:0px !important; } " 
    + ".container { width:100% !important; } "
    + ".end_space { min-height:0px !important; } "
    + "</style>"))
Run Code Online (Sandbox Code Playgroud)

顶行删除顶部的灰色边距,中间线移除侧边距,底部线条删除底部的灰色边距.内容在两者之间<style>,</style>当然也可添加到所述的罐custom.css文件在~/.jupyter/custom/以下这个线程 ; 我的文件包含行

/* Modifications to notebook format  */
#notebook { padding-top:0px !important; } /* eliminate top gray */
.container { width:100% !important; } /* eliminate side gray */
.end_space { min-height:0px !important; } /* eliminate bottom gray */
Run Code Online (Sandbox Code Playgroud)