我在一个闪亮的R应用程序中使用splitLayout
来创建一个两个面板的结构,左边有一个图(一个googleVis
gVisGeoChart
对象),右边是HTML.
这是一个有问题的代码的模型:
splitLayout(
htmlOutput("mychart"), #This winds up rendering properly to the left side of the window
div(
h1("A descriptive heading"),
p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.")
) #This text will not wrap to the right side of the splitLayout frame
)
p()命令中的文本不会换行到splitLayout创建的页面的可见部分(1/2)。相反,它一直转到(不可见的)右侧,需要用户滚动才能看到所有内容。这不是想要的行为(坦率地说,我很难想象它会是什么情况)。
如何确保文本正确换行到splitLayout区域?
发布于 2018-06-01 04:12:18
太老了,但是我已经在这个问题上卡住了一段时间,之前的答案不起作用。多亏了一些html检查,我终于找到了答案。您需要为splitLayout添加一个样式元素,即:‘空白: normal',(对于splitLayout,它默认设置为’空白: nowrap‘)。见下文,在原始问题的上下文中使用。
splitLayout(
htmlOutput("mychart"), #This winds up rendering properly to the left side of the window
div(
h1("A descriptive heading"),
p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.")
),
cellArgs = list(style='white-space: normal;')
)
发布于 2017-12-06 03:56:04
添加style = "word-wrap: break-word;"
p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.",
style = "word-wrap: break-word;")
https://stackoverflow.com/questions/41111636
复制相似问题