您能否在Jupyter笔记本中的单元格中添加边框,该边框在呈现输出后仍然保留?

2024-06-16 10:46:40 发布

您现在位置:Python中文网/ 问答频道 /正文

下面是一个基本笔记本的示例:

example

在处理某个单元格时,我知道该特定单元格周围会有一个临时边框,以突出显示该特定单元格已被选中-在我的示例中,突出显示“简介”单元格。这不是我在问题中所指的边界

我很想知道是否可以在渲染输出后保留的任何单元格(特别是标记)周围添加边框。这有点像在Microsoft Excel中为一个或多个单元格添加边框。这只是出于造型的目的

有人有什么想法吗?欢迎提供任何建议:)

以下是在每个单元格中写入的文本,以供参考:

# <span style="color:red">Example</span>
<u> **Introduction:** </u>  
This notebook is just an example.
# Here is some code:

num = [1, 2, 3]
for i in num:
    num = i + 1
    print(num)
<span style="color:blue">***The End***</span>

Tags: 标记目的示例isstyle笔记本excelnum
1条回答
网友
1楼 · 发布于 2024-06-16 10:46:40

这个问题的答案可以帮助你

按说明获取对Jupyter custom.css文件的访问权here

并添加以下内容:

.rendered_html table, .rendered_html th, .rendered_html tr, .rendered_html td {
  border: 1px  red solid !important;
  color: red !important;
}

如果您想进行更多个性化设置,请查看Jupyter Themes

相关问题 更多 >