Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何更改JupyterLab中单元格的样式/宽度?_Html_Css_Python 3.x_Ipython_Jupyter Lab - Fatal编程技术网

Html 如何更改JupyterLab中单元格的样式/宽度?

Html 如何更改JupyterLab中单元格的样式/宽度?,html,css,python-3.x,ipython,jupyter-lab,Html,Css,Python 3.x,Ipython,Jupyter Lab,我试过了 从IPython.core.display导入显示,HTML 显示(HTML(“.container{width:60%!important;}”)) 从这个。我也试过了 from IPython.core.display import display, HTML display(HTML("<style>.container { width:60% !important; }</style>")) %%%html .container{

我试过了

从IPython.core.display导入显示,HTML
显示(HTML(“.container{width:60%!important;}”))
从这个。我也试过了

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:60% !important; }</style>"))
%%%html
.container{宽度:60%!重要;}
但它们不起作用


类的名称在JupyterLab中重新修改,现在更容易理解和预测。对JupyterLab使用以下选择器:

  • .jp单元格
    更改所有单元格的宽度
  • .jp Cell.jp CodeCell
    仅更改带有代码的单元格的宽度
  • .jp Cell.jp MarkdownCell
    更改标记单元格宽度的步骤
  • .jp Cell.jp Editor
    仅更改编辑器的宽度
  • .jp OutputArea output
    更改单元格输出的
例如,要使用IPython缩小单元格宽度,可以使用:

%%html
<style>.container { width:60% !important; }</style>
从IPython.core.display导入显示,HTML
显示(HTML(“.jp单元格{宽度:60%!重要;}”))

您可以使用DOM inspector,这是目前所有浏览器都提供的工具(请参阅说明),来检查您希望修改的特定元素的类名。

这就像一个符咒一样,工作得非常出色。在我们调整宽度后,是否还有其他方法将单元格居中?如果能收到您对我的新问题,那将是非常棒和完整的。行
显示(HTML(“.jp outputrea output{width:100%!important;margin:0 auto;}”)
在我的JupyterLab中不起作用。你能看看我的问题吗?
from IPython.core.display import display, HTML
display(HTML("<style>.jp-Cell { width: 60% !important; }</style>"))