如何具有不同宽度的代码单元和输出单元? [英] How to have different widths of code cell and output cell?

查看:67
本文介绍了如何具有不同宽度的代码单元和输出单元?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过此

能否请您详细说明如何调整输出像元的宽度?

更新:我也尝试过

  display(HTML(< style> .jp-Cell.jp-CodeCell.jp-Cell-inputWrapper {width:70%!important; margin:0 auto;}</style>";))display(HTML(< style> .jp-Cell.jp-CodeCell.jp-Cell-outputWrapper {width:100%!important; margin:0 auto;}</style>)) 

,但是它们不起作用.

解决方案

似乎我找到了解决方法

来自IPython.core.display的

 导入显示,HTMLdisplay(HTML(< style> .jp-CodeCell .jp-Cell-inputWrapper {width:80%!important; margin:0 auto;}</style>"))display(HTML(< style> .jp-MarkdownCell .jp-Cell-inputWrapper {width:90%!important; margin:0 auto;}</style>))display(HTML(< style> .jp-Cell-outputWrapper {width:100%!important; margin:0 auto;}</style"))) 

From this answer, I've been able to adjust the widths of code cell and markdown cell independently

from IPython.core.display import display, HTML
display(HTML("<style>.jp-Cell.jp-CodeCell { width: 70% !important;  margin: 0 auto; }</style>"))
display(HTML("<style>.jp-Cell.jp-MarkdownCell { width: 90% !important;  margin: 0 auto; }</style>"))

Then I also want to keep the output cell intact so that I can display big plot with

display(HTML("<style>.jp-OutputArea-output { width: 100% !important;  margin: 0 auto; }</style>"))

Unfortunately, it does not work

Could you please elaborate on how to adjust the width of the output cell?

Update: I also tried

display(HTML("<style>.jp-Cell.jp-CodeCell.jp-Cell-inputWrapper { width: 70% !important;  margin: 0 auto; }</style>"))
display(HTML("<style>.jp-Cell.jp-CodeCell.jp-Cell-outputWrapper { width: 100% !important;  margin: 0 auto; }</style>"))

, but they did not work.

解决方案

It seems that I found the solution

from IPython.core.display import display, HTML
display(HTML("<style>.jp-CodeCell .jp-Cell-inputWrapper { width: 80% !important;  margin: 0 auto; }</style>"))
display(HTML("<style>.jp-MarkdownCell .jp-Cell-inputWrapper { width: 90% !important;  margin: 0 auto; }</style>"))
display(HTML("<style>.jp-Cell-outputWrapper { width: 100% !important;  margin: 0 auto; }</style>"))

这篇关于如何具有不同宽度的代码单元和输出单元?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆