本文介绍了如何在JupyterLab中更改单元格的样式/宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我尝试过

来自IPython.core.display的

 导入显示,HTMLdisplay(HTML(< style> .container {width:60%!important;}</style>"))) 

来自此

解决方案

在JupyterLab中对类的名称进行了重新设计,现在更易于理解和预测.对JupyterLab使用以下选择器:

  • .jp-Cell 更改所有单元格的宽度
  • .jp-Cell.jp-CodeCell 仅更改带有代码的单元格的宽度
  • .jp-Cell.jp-MarkdownCell 来更改降价单元格的宽度
  • .jp-Cell.jp-Editor 仅更改编辑器的宽度
  • .jp-OutputArea-output 更改单元格输出的with

例如,要使用IPython减小单元格的宽度,您可以使用:

来自IPython.core.display的

 导入显示,HTMLdisplay(HTML(< style> .jp-Cell {width:60%!important;}</style>"))) 

您可以使用 DOM检查器,该工具是当今所有浏览器都提供的工具(请参阅说明此处)以检查要修改的特定元素的类名.

I tried

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:60% !important; }</style>"))

from this answer. I also tried

%%html
<style>.container { width:60% !important; }</style>

but they don't work.

解决方案

The names of classes were reworked in JupyterLab and are now easier to understand and more predictable. Use the following selectors for JupyterLab:

  • .jp-Cell to change the width of all cells
  • .jp-Cell.jp-CodeCell to change only width of the cells with code
  • .jp-Cell.jp-MarkdownCell to change the width of markdown cells
  • .jp-Cell.jp-Editor to change width of the editor only
  • .jp-OutputArea-output to change the with of cell outputs

For example, to reduce the width of cells using IPython you could use:

from IPython.core.display import display, HTML
display(HTML("<style>.jp-Cell { width: 60% !important; }</style>"))

You can use the DOM inspector, a tool that all browsers provide nowadays, (see the instructions here) to check class names of specific elements that you wish to modify.

这篇关于如何在JupyterLab中更改单元格的样式/宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 11:12