【发布时间】:2015-03-29 20:11:44
【问题描述】:
我想将 IPython 笔记本的宽度设置为 2500 像素,并且我希望它左对齐。我该怎么做?
我使用这段代码来应用我自己的 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 像素大小的水平滚动。所以只有我的单元格的前半部分是可见的。
如果我将width: 2500px; 设置为#notebook 或#notebook_panel,则水平滚动消失,因此笔记本网页宽度将为2500 像素宽,我看到我的单元格已满,但对齐将居中。为什么?
我也在 Firefox 和 Chrome 中尝试过。
感谢您的帮助!
【问题讨论】:
标签: css width ipython-notebook