我想将 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/