我想将我的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脚本,那么我的笔记本网页将对齐到左边,单元格的宽度为2000px,但网页变成水平可滚动的大小为1000px。因此,只有我的细胞的前半部分可见。
如果我将width: 2500px;
设置为#notebook
或#notebook_panel
,则横向滚动消失,因此笔记本网页宽度将为2500px宽,我看到我的细胞已满,但对齐将成为中心。为什么呢?
我也在Firefox和Chrome中尝试过它。
感谢您的帮助!
答案 0 :(得分:2)
以下是解决方案:How do I increase the cell width of the Jupyter/ipython notebook in my browser?
<style>
.container { width:100% !important; }
</style>