我使用以下行来更改 Markdown 单元格的样式
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
中按预期工作(它更改了 markdown 的默认字体)但在 jupyter-lab
中没有效果。
我应该怎么做?
最佳答案
JupyterLab 使用的 CSS 类集与 jupyter-notebook 不同。
要定位要使用 jp-MarkdownOutput
类的 Markdown 单元格,例如:
<style>
div.jp-MarkdownOutput {font-family: "Times New Roman", Times, serif;}
</style>
您可以在 the documentation 中阅读有关 JupyterLab 中 CSS 的更多信息.
关于python - Jupyter Lab 中的自定义样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50600808/