python - Jupyter Lab 中的自定义样式

标签 python css jupyter-notebook jupyter-lab

我使用以下行来更改 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/

相关文章:

python-3.x - Jupyter Notebook 中缺少模块导入时出错

python - 使用索引作为 x 轴标签绘制直方图

python - 序数逻辑回归 : Intercept_ returns [1] instead of [n]

CSS 网格 - 不必要的断字

html - 面板有两个部分

java - 是否可以在Google Colab中引入Java运行时类型?

python - Django教程-查看详情时轮询错误404

python - 当 "id"绑定(bind)点在 cosmosDB 集合中没有相应的项目时,用 python 编写的 Azure 函数有 500

html - 如何从 svg 文本中删除上部间隙

javascript - Bokeh:将变量传递给 Widgets 的 CustomJS