2017-06-01 114 views
1

我在this thread阅读如何更改Jupyter笔记本电脑的宽度的单元格(我使用second answer动态地这样做)。此方法消除了左右灰色边框。如何消除浏览器中Jupyter/ipython笔记本周围的灰色边框?

但是,这仍在文档的顶部和底部处留下灰色边框。我怎样才能消除这种情况,让细胞躺在干净的石板上?

+0

你的意思是1票或99票的答案?你可以通过点击答案下方的共享来分享答案的网址...答案网址会出现,你可以复制 –

+0

谢谢,更新了问题的链接。 –

+0

编辑答案.. –

回答

0

因此,使用“检查元素”在笔记本和学习CSS的丝毫之后,似乎下面的工作

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>")) 

顶部线条去除顶部的灰色边缘,中间线条去除边缘,底部线条去除底部的灰色边缘。 <style>,</style>之间的内容当然也可以加入this thread之后的~/.jupyter/custom/中的custom.css文件;我的文件包含行

/* 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 */ 
0

我将在下面添加到我的CSS

*{margin:0; 
    padding:0; 
} 

html, body, .container{ 
    margin:0!important; 
    padding:0!important; 
} 

而且应该摆脱在顶部和底部的额外空间,以及双方的。如果这是你通过一个边界是指一条线,你可以

看到评论后更新添加border:0;到HTML,身体的CSS:

从你给出的解决方案,你也可以做同样的与高度(height:100%;!important),但在我的经验设置100%的高度属性不如宽度有效(因为高度更动态)首先尝试html/body的东西。与HTML /机身内嵌样式

例如属性:

from IPython.core.display import display, HTML 
display(HTML("<style> *{margin:0; padding:0;} html, body, .container{margin:0;!important padding:0;!important} .container { width:100% !important;}</style>")) 
+0

你可以将html和body css也添加到内联样式中,但是css样式表比内联样式更可取。 –

+0

似乎不适合我;它仍然留下顶部/底部边距。我根本不了解HTML/CSS,但是我使用了Inspect Element,发现'.end_space {min-height:0px!important; ''摆脱**底部**边缘。不知道如何摆脱顶部边距。您的解决方案是否适合您? –

+0

在容器和div中,设置margin和padding为!important。你可以拿出高度的东西 –