Jupyter实验室的定制风格

时间:2018-05-30 09:14:26

标签: python css jupyter-notebook jupyter-lab

我使用以下行来更改降价单元格的样式

from IPython.core.display import HTML
with open( './custom.css', 'r' ) as f: style = f.read()
HTML( style )

文件custom.css包含行

<style>
   div.text_cell_render {font-family: "Times New Roman", Times, serif;}
</style>

这在jupyter-notebook中按预期工作(它会更改降价的默认字体)但在jupyter-lab中无效。

我该怎么做?

1 个答案:

答案 0 :(得分:2)

JupyterLab使用的CSS类集与jupyter-notebook不同。

要定位要使用jp-MarkdownOutput类的降价单元,例如:

<style>
   div.jp-MarkdownOutput {font-family: "Times New Roman", Times, serif;}
</style>

您可以在the documentation的JupyterLab中阅读有关CSS的更多信息。